MCPcopy Index your code
hub / github.com/python/cpython / test_empty_names

Method test_empty_names

Lib/test/test_enum.py:3517–3524  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3515 Flag(7)
3516
3517 def test_empty_names(self):
3518 for nothing in '', [], {}:
3519 for e_type in None, int:
3520 empty_enum = Enum('empty_enum', nothing, type=e_type)
3521 self.assertEqual(len(empty_enum), 0)
3522 self.assertRaisesRegex(TypeError, 'has no members', empty_enum, 0)
3523 self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', names=0)
3524 self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', 0, type=int)
3525
3526 def test_nonhashable_matches_hashable(self): # issue 125710
3527 class Directions(Enum):

Callers

nothing calls this directly

Calls 3

EnumClass · 0.90
assertRaisesRegexMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected