diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2013-09-06 14:16:48 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2013-09-06 14:16:48 (GMT) |
commit | f203f2d51da404fd59cbfbf40201fe30bd9ea79c (patch) | |
tree | cd0221640a9d9445eada6cfcc21128ff72ec68d3 /Lib/test/test_enum.py | |
parent | 96d848ace4785077c2852ede46895775854be676 (diff) | |
download | cpython-f203f2d51da404fd59cbfbf40201fe30bd9ea79c.zip cpython-f203f2d51da404fd59cbfbf40201fe30bd9ea79c.tar.gz cpython-f203f2d51da404fd59cbfbf40201fe30bd9ea79c.tar.bz2 |
Close #18924: Block naive attempts to change an Enum member.
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 2a589f5..018e3fd 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -152,6 +152,11 @@ class TestEnum(unittest.TestCase): 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): |