mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
gh-116040: [Enum] fix test_empty_names test (GH-116508)
* and fix _not_given usage
This commit is contained in:
parent
34920f3691
commit
3c0dcef980
2 changed files with 8 additions and 14 deletions
|
|
@ -3431,17 +3431,13 @@ class TestSpecial(unittest.TestCase):
|
|||
Flag(7)
|
||||
|
||||
def test_empty_names(self):
|
||||
for nothing, e_type in (
|
||||
('', None),
|
||||
('', int),
|
||||
([], None),
|
||||
([], int),
|
||||
({}, None),
|
||||
({}, int),
|
||||
):
|
||||
empty_enum = Enum('empty_enum', nothing, type=e_type)
|
||||
self.assertEqual(len(empty_enum), 0)
|
||||
self.assertRaises(TypeError, 'has no members', empty_enum, 0)
|
||||
for nothing in '', [], {}:
|
||||
for e_type in None, int:
|
||||
empty_enum = Enum('empty_enum', nothing, type=e_type)
|
||||
self.assertEqual(len(empty_enum), 0)
|
||||
self.assertRaisesRegex(TypeError, 'has no members', empty_enum, 0)
|
||||
self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', names=0)
|
||||
self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', 0, type=int)
|
||||
|
||||
|
||||
class TestOrder(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue