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

Method test_slots_weakref

Lib/test/test_dataclasses/__init__.py:3687–3696  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3685 a.__weakref__
3686
3687 def test_slots_weakref(self):
3688 @dataclass(slots=True, weakref_slot=True)
3689 class A:
3690 a: int
3691
3692 self.assertIn("__weakref__", A.__slots__)
3693 a = A(1)
3694 a_ref = weakref.ref(a)
3695
3696 self.assertIs(a.__weakref__, a_ref)
3697
3698 def test_slots_weakref_base_str(self):
3699 class Base:

Callers

nothing calls this directly

Calls 3

assertInMethod · 0.80
AClass · 0.70
assertIsMethod · 0.45

Tested by

no test coverage detected