summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2013-08-04 15:42:23 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2013-08-04 15:42:23 (GMT)
commit5e5a8230c206e5762b5d4c0708189422c1b1f3b1 (patch)
treed2e7c6f0cd4a05d60fcd14b4b4daaf6eed897fa8 /Lib/test/test_enum.py
parentaf760db0670a8891ea160111b24eabcea2088223 (diff)
downloadcpython-5e5a8230c206e5762b5d4c0708189422c1b1f3b1.zip
cpython-5e5a8230c206e5762b5d4c0708189422c1b1f3b1.tar.gz
cpython-5e5a8230c206e5762b5d4c0708189422c1b1f3b1.tar.bz2
Close #18635: Move class level private attribute from instance to class.
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r--Lib/test/test_enum.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 91c4b69..b959e97 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -583,6 +583,24 @@ class TestEnum(unittest.TestCase):
option3 = 3
self.assertEqual(int(MailManOptions.option1), 1)
+ def test_introspection(self):
+ class Number(IntEnum):
+ one = 100
+ two = 200
+ self.assertIs(Number.one._member_type_, int)
+ self.assertIs(Number._member_type_, int)
+ class String(str, Enum):
+ yarn = 'soft'
+ rope = 'rough'
+ wire = 'hard'
+ self.assertIs(String.yarn._member_type_, str)
+ self.assertIs(String._member_type_, str)
+ class Plain(Enum):
+ vanilla = 'white'
+ one = 1
+ self.assertIs(Plain.vanilla._member_type_, object)
+ self.assertIs(Plain._member_type_, object)
+
def test_no_such_enum_member(self):
class Color(Enum):
red = 1