(self)
| 3671 | self.assertEqual(obj.b, 'b') |
| 3672 | |
| 3673 | def test_slots_no_weakref(self): |
| 3674 | @dataclass(slots=True) |
| 3675 | class A: |
| 3676 | # No weakref. |
| 3677 | pass |
| 3678 | |
| 3679 | self.assertNotIn("__weakref__", A.__slots__) |
| 3680 | a = A() |
| 3681 | with self.assertRaisesRegex(TypeError, |
| 3682 | "cannot create weak reference"): |
| 3683 | weakref.ref(a) |
| 3684 | with self.assertRaises(AttributeError): |
| 3685 | a.__weakref__ |
| 3686 | |
| 3687 | def test_slots_weakref(self): |
| 3688 | @dataclass(slots=True, weakref_slot=True) |
nothing calls this directly
no test coverage detected