(self)
| 8375 | NamedTuple(typename='Emp', name=str, id=int) |
| 8376 | |
| 8377 | def test_copy_and_pickle(self): |
| 8378 | global Emp # pickle wants to reference the class by name |
| 8379 | Emp = NamedTuple('Emp', [('name', str), ('cool', int)]) |
| 8380 | for cls in Emp, CoolEmployee, self.NestedEmployee: |
| 8381 | with self.subTest(cls=cls): |
| 8382 | jane = cls('jane', 37) |
| 8383 | for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 8384 | z = pickle.dumps(jane, proto) |
| 8385 | jane2 = pickle.loads(z) |
| 8386 | self.assertEqual(jane2, jane) |
| 8387 | self.assertIsInstance(jane2, cls) |
| 8388 | |
| 8389 | jane2 = copy(jane) |
| 8390 | self.assertEqual(jane2, jane) |
| 8391 | self.assertIsInstance(jane2, cls) |
| 8392 | |
| 8393 | jane2 = deepcopy(jane) |
| 8394 | self.assertEqual(jane2, jane) |
| 8395 | self.assertIsInstance(jane2, cls) |
| 8396 | |
| 8397 | def test_orig_bases(self): |
| 8398 | T = TypeVar('T') |
nothing calls this directly
no test coverage detected