8000 bpo-40025: Require _generate_next_value_ to be defined before members by abbyonstott · Pull Request #19098 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40025: Require _generate_next_value_ to be defined before members #19098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 28, 2020
Prev Previous commit
Next Next commit
Add test for TypeError raised on incorrect order
  • Loading branch information
abbyonstott committed Mar 21, 2020
commit a386b25e5e38ddd48dad5598ec06b854a00ea995
10 changes: 10 additions & 0 deletions Lib/test/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,16 @@ class Color(Enum):
self.assertEqual(Color.blue.value, 2)
self.assertEqual(Color.green.value, 3)

def test_auto_order(self):
with self.assertRaises(TypeError):
class Color(Enum):
red = auto()
green = auto()
blue = auto()
def _generate_next_value_(name, start, count, last):
return name


def test_duplicate_auto(self):
class Dupes(Enum):
first = primero = auto()
Expand Down
0