MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_tuple_subclass_with_auto_2

Method test_tuple_subclass_with_auto_2

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

Source from the content-addressed store, hash-verified

2432 test_pickle_dump_load(self.assertIs, SomeEnum.first)
2433
2434 def test_tuple_subclass_with_auto_2(self):
2435 from collections import namedtuple
2436 T = namedtuple('T', 'index desc')
2437 class SomeEnum(Enum):
2438 __qualname__ = 'SomeEnum' # needed for pickle protocol 4
2439 first = T(auto(), 'for the money')
2440 second = T(auto(), 'for the show')
2441 third = T(auto(), 'for the music')
2442 self.assertIs(type(SomeEnum.first), SomeEnum)
2443 self.assertEqual(SomeEnum.third.value, (3, 'for the music'))
2444 self.assertIsInstance(SomeEnum.third.value, T)
2445 self.assertEqual(SomeEnum.first.value.index, 1)
2446 self.assertEqual(SomeEnum.second.value.desc, 'for the show')
2447 globals()['SomeEnum'] = SomeEnum
2448 globals()['T'] = T
2449 test_pickle_dump_load(self.assertIs, SomeEnum.first)
2450
2451 def test_duplicate_values_give_unique_enum_items(self):
2452 class AutoNumber(Enum):

Callers

nothing calls this directly

Calls 6

namedtupleFunction · 0.90
globalsFunction · 0.85
test_pickle_dump_loadFunction · 0.85
assertIsInstanceMethod · 0.80
assertIsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected