mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Close #19252: better test coverage for Enum. Thanks, CliffM
This commit is contained in:
parent
1f2eaa97eb
commit
1a16288197
1 changed files with 4 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue