From f203f2d51da404fd59cbfbf40201fe30bd9ea79c Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Fri, 6 Sep 2013 07:16:48 -0700 Subject: Close #18924: Block naive attempts to change an Enum member. --- Lib/test/test_enum.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Lib/test/test_enum.py') diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 2a589f5a3b..018e3fdab7 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): -- cgit v1.2.1