diff options
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index a83241c..19b4fa5 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -2119,7 +2119,7 @@ class TestEnum(unittest.TestCase): one = '1' two = b'2', 'ascii', 9 - def test_init_subclass(self): + def test_init_subclass_calling(self): class MyEnum(Enum): def __init_subclass__(cls, **kwds): super(MyEnum, cls).__init_subclass__(**kwds) @@ -2155,6 +2155,16 @@ class TestEnum(unittest.TestCase): self.assertFalse(NeverEnum.__dict__.get('_test1', False)) self.assertFalse(NeverEnum.__dict__.get('_test2', False)) + def test_init_subclass_parameter(self): + class multiEnum(Enum): + def __init_subclass__(cls, multi): + for member in cls: + member._as_parameter_ = multi * member.value + class E(multiEnum, multi=3): + A = 1 + B = 2 + self.assertEqual(E.A._as_parameter_, 3) + self.assertEqual(E.B._as_parameter_, 6) @unittest.skipUnless( sys.version_info[:2] == (3, 9), |