Commit 57822dfd authored by Ethan Furman's avatar Ethan Furman

Close #19252: better test coverage for Enum. Thanks, CliffM

parent 25ada495
...@@ -1139,8 +1139,10 @@ class TestEnum(unittest.TestCase): ...@@ -1139,8 +1139,10 @@ class TestEnum(unittest.TestCase):
green = () green = ()
blue = () blue = ()
self.assertEqual(list(ColorInAList), [ColorInAList.red, ColorInAList.green, ColorInAList.blue]) self.assertEqual(list(ColorInAList), [ColorInAList.red, ColorInAList.green, ColorInAList.blue])
self.assertEqual(ColorInAList.red.value, [1]) for enum, value in zip(ColorInAList, range(3)):
self.assertEqual(ColorInAList([1]), ColorInAList.red) value += 1
self.assertEqual(enum.value, [value])
self.assertIs(ColorInAList([value]), enum)
def test_conflicting_types_resolved_in_new(self): def test_conflicting_types_resolved_in_new(self):
class LabelledIntEnum(int, Enum): class LabelledIntEnum(int, Enum):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment