diff Lib/test/test_enum.py @ 86389:89f6abc2e115

Close #19252: better test coverage for Enum. Thanks, CliffM
author Ethan Furman <ethan@stoneleaf.us>
date Wed, 16 Oct 2013 19:09:31 -0700
parents 516576f5f9dc
children b9019b942435
line wrap: on
line diff
--- a/Lib/test/test_enum.py	Wed Oct 16 17:06:22 2013 +0100
+++ b/Lib/test/test_enum.py	Wed Oct 16 19:09:31 2013 -0700
@@ -1139,8 +1139,10 @@
             green = ()
             blue = ()
         self.assertEqual(list(ColorInAList), [ColorInAList.red, ColorInAList.green, ColorInAList.blue])
-        self.assertEqual(ColorInAList.red.value, [1])
-        self.assertEqual(ColorInAList([1]), ColorInAList.red)
+        for enum, value in zip(ColorInAList, range(3)):
+            value += 1
+            self.assertEqual(enum.value, [value])
+            self.assertIs(ColorInAList([value]), enum)
 
     def test_conflicting_types_resolved_in_new(self):
         class LabelledIntEnum(int, Enum):