diff Lib/test/test_enum.py @ 85574:1d88d04aade2

Close #18924: Block naive attempts to change an Enum member.
author Ethan Furman <ethan@stoneleaf.us>
date Fri, 06 Sep 2013 07:16:48 -0700
parents 058cb219b3b5
children 24aa6f98fe25
line wrap: on
line diff
--- a/Lib/test/test_enum.py	Fri Sep 06 06:55:58 2013 -0700
+++ b/Lib/test/test_enum.py	Fri Sep 06 07:16:48 2013 -0700
@@ -152,6 +152,11 @@
         with self.assertRaises(AttributeError):
             Season.SPRING.value = 2
 
+    def test_changing_member(self):
+        Season = self.Season
+        with self.assertRaises(AttributeError):
+            Season.WINTER = 'really cold'
+
     def test_invalid_names(self):
         with self.assertRaises(ValueError):
             class Wrong(Enum):