(self)
| 538 | C() |
| 539 | |
| 540 | def test_field_default(self): |
| 541 | default = object() |
| 542 | @dataclass |
| 543 | class C: |
| 544 | x: object = field(default=default) |
| 545 | |
| 546 | self.assertIs(C.x, default) |
| 547 | c = C(10) |
| 548 | self.assertEqual(c.x, 10) |
| 549 | |
| 550 | # If we delete the instance attribute, we should then see the |
| 551 | # class attribute. |
| 552 | del c.x |
| 553 | self.assertIs(c.x, default) |
| 554 | |
| 555 | self.assertIs(C().x, default) |
| 556 | |
| 557 | def test_not_in_repr(self): |
| 558 | @dataclass |
nothing calls this directly
no test coverage detected