(self)
| 5515 | self.assertEqual(weakref.ref(t)(), t) |
| 5516 | |
| 5517 | def test_parameterized_slots(self): |
| 5518 | T = TypeVar('T') |
| 5519 | class C(Generic[T]): |
| 5520 | __slots__ = ('potato',) |
| 5521 | |
| 5522 | c = C() |
| 5523 | c_int = C[int]() |
| 5524 | |
| 5525 | c.potato = 0 |
| 5526 | c_int.potato = 0 |
| 5527 | with self.assertRaises(AttributeError): |
| 5528 | c.tomato = 0 |
| 5529 | with self.assertRaises(AttributeError): |
| 5530 | c_int.tomato = 0 |
| 5531 | |
| 5532 | def foo(x: C['C']): ... |
| 5533 | self.assertEqual(get_type_hints(foo, globals(), locals())['x'], C[C]) |
| 5534 | self.assertEqual(copy(C[int]), deepcopy(C[int])) |
| 5535 | |
| 5536 | def test_parameterized_slots_dict(self): |
| 5537 | T = TypeVar('T') |
nothing calls this directly
no test coverage detected