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

Method test_programmatic_function_from_dict

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

Source from the content-addressed store, hash-verified

744 self.assertIs(e, MinorEnum(av))
745
746 def test_programmatic_function_from_dict(self):
747 MinorEnum = self.enum_type(
748 'MinorEnum',
749 OrderedDict((('june', self.source_values[0]), ('july', self.source_values[1]), ('august', self.source_values[2])))
750 )
751 lst = list(MinorEnum)
752 self.assertEqual(len(lst), len(MinorEnum))
753 self.assertEqual(len(MinorEnum), 3, MinorEnum)
754 self.assertEqual(
755 [MinorEnum.june, MinorEnum.july, MinorEnum.august],
756 lst,
757 )
758 for month, av in zip('june july august'.split(), self.values):
759 e = MinorEnum[month]
760 if MinorEnum._member_type_ is not object and issubclass(MinorEnum, MinorEnum._member_type_):
761 self.assertEqual(e, av)
762 else:
763 self.assertNotEqual(e, av)
764 self.assertIn(e, MinorEnum)
765 self.assertIs(type(e), MinorEnum)
766 self.assertIs(e, MinorEnum(av))
767
768 def test_repr(self):
769 TE = self.MainEnum

Callers

nothing calls this directly

Calls 7

OrderedDictClass · 0.90
listClass · 0.85
assertNotEqualMethod · 0.80
assertInMethod · 0.80
assertEqualMethod · 0.45
splitMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected