]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Close #19252: better test coverage for Enum. Thanks, CliffM
authorEthan Furman <ethan@stoneleaf.us>
Thu, 17 Oct 2013 02:09:31 +0000 (19:09 -0700)
committerEthan Furman <ethan@stoneleaf.us>
Thu, 17 Oct 2013 02:09:31 +0000 (19:09 -0700)
Lib/test/test_enum.py

index 3d962f9688eded4c75fe0377c6e40d9485187121..77477dfb6549d495d37ec087cdb3c3779da4f3df 100644 (file)
@@ -1139,8 +1139,10 @@ class TestEnum(unittest.TestCase):
             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):