Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a16288

Browse files
committed
Close #19252: better test coverage for Enum. Thanks, CliffM
1 parent 1f2eaa9 commit 1a16288

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/test/test_enum.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,10 @@ class ColorInAList(AutoNumberInAList):
11391139
green = ()
11401140
blue = ()
11411141
self.assertEqual(list(ColorInAList), [ColorInAList.red, ColorInAList.green, ColorInAList.blue])
1142-
self.assertEqual(ColorInAList.red.value, [1])
1143-
self.assertEqual(ColorInAList([1]), ColorInAList.red)
1142+
for enum, value in zip(ColorInAList, range(3)):
1143+
value += 1
1144+
self.assertEqual(enum.value, [value])
1145+
self.assertIs(ColorInAList([value]), enum)
11441146

11451147
def test_conflicting_types_resolved_in_new(self):
11461148
class LabelledIntEnum(int, Enum):

0 commit comments

Comments
 (0)