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

Method test_tuple_subclass_with_auto_1

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

Source from the content-addressed store, hash-verified

2445 test_pickle_dump_load(self.assertIs, SomeTuple.first)
2446
2447 def test_tuple_subclass_with_auto_1(self):
2448 from collections import namedtuple
2449 T = namedtuple('T', 'index desc')
2450 class SomeEnum(T, Enum):
2451 __qualname__ = 'SomeEnum' # needed for pickle protocol 4
2452 first = auto(), 'for the money'
2453 second = auto(), 'for the show'
2454 third = auto(), 'for the music'
2455 self.assertIs(type(SomeEnum.first), SomeEnum)
2456 self.assertEqual(SomeEnum.third.value, (3, 'for the music'))
2457 self.assertIsInstance(SomeEnum.third.value, T)
2458 self.assertEqual(SomeEnum.first.index, 1)
2459 self.assertEqual(SomeEnum.second.desc, 'for the show')
2460 globals()['SomeEnum'] = SomeEnum
2461 globals()['T'] = T
2462 test_pickle_dump_load(self.assertIs, SomeEnum.first)
2463
2464 def test_tuple_subclass_with_auto_2(self):
2465 from collections import namedtuple

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected