(self)
| 5408 | self.assertEqual(weakref.ref(t)(), t) |
| 5409 | |
| 5410 | def test_parameterized_slots(self): |
| 5411 | T = TypeVar('T') |
| 5412 | class C(Generic[T]): |
| 5413 | __slots__ = ('potato',) |
| 5414 | |
| 5415 | c = C() |
| 5416 | c_int = C[int]() |
| 5417 | |
| 5418 | c.potato = 0 |
| 5419 | c_int.potato = 0 |
| 5420 | with self.assertRaises(AttributeError): |
| 5421 | c.tomato = 0 |
| 5422 | with self.assertRaises(AttributeError): |
| 5423 | c_int.tomato = 0 |
| 5424 | |
| 5425 | def foo(x: C['C']): ... |
| 5426 | self.assertEqual(get_type_hints(foo, globals(), locals())['x'], C[C]) |
| 5427 | self.assertEqual(copy(C[int]), deepcopy(C[int])) |
| 5428 | |
| 5429 | def test_parameterized_slots_dict(self): |
| 5430 | T = TypeVar('T') |
nothing calls this directly
no test coverage detected