diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2017-06-22 01:52:32 +0900 |
---|---|---|
committer | ethanfurman <ethan@stoneleaf.us> | 2017-06-21 09:52:32 -0700 |
commit | dcc8ce44c74492670e6bfbde588a2acbf8f365e0 (patch) | |
tree | 911ffe701c25f1be9beeeeae22f924516a95e025 /Lib/test/test_enum.py | |
parent | 5ff7132313eb651107b179d20218dfe5d4e47f13 (diff) | |
download | cpython-git-dcc8ce44c74492670e6bfbde588a2acbf8f365e0.tar.gz |
bpo-30616: Functional API of enum allows to create empty enums. (#2304)
* bpo-30616: Functional API of enum allows to create empty enums.
* Update NEWS
move addition to avoid conflict
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index a973081644..ea52de7a5f 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -2291,6 +2291,26 @@ class TestIntFlag(unittest.TestCase): self.assertIs(type(e), Perm) + def test_programatic_function_from_empty_list(self): + Perm = enum.IntFlag('Perm', []) + lst = list(Perm) + self.assertEqual(len(lst), len(Perm)) + self.assertEqual(len(Perm), 0, Perm) + Thing = enum.Enum('Thing', []) + lst = list(Thing) + self.assertEqual(len(lst), len(Thing)) + self.assertEqual(len(Thing), 0, Thing) + + + def test_programatic_function_from_empty_tuple(self): + Perm = enum.IntFlag('Perm', ()) + lst = list(Perm) + self.assertEqual(len(lst), len(Perm)) + self.assertEqual(len(Perm), 0, Perm) + Thing = enum.Enum('Thing', ()) + self.assertEqual(len(lst), len(Thing)) + self.assertEqual(len(Thing), 0, Thing) + def test_containment(self): Perm = self.Perm R, W, X = Perm |