[Python-checkins] cpython: Close #19252: better test coverage for Enum. Thanks, CliffM

ethan.furman python-checkins at python.org
Thu Oct 17 04:09:36 CEST 2013


http://hg.python.org/cpython/rev/89f6abc2e115
changeset:   86389:89f6abc2e115
user:        Ethan Furman <ethan at stoneleaf.us>
date:        Wed Oct 16 19:09:31 2013 -0700
summary:
  Close #19252: better test coverage for Enum.  Thanks, CliffM

files:
  Lib/test/test_enum.py |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list