(self)
| 634 | assert False, f'unknown result {result!r}' |
| 635 | |
| 636 | def test_init_false_no_default(self): |
| 637 | # If init=False and no default value, then the field won't be |
| 638 | # present in the instance. |
| 639 | @dataclass |
| 640 | class C: |
| 641 | x: int = field(init=False) |
| 642 | |
| 643 | self.assertNotIn('x', C().__dict__) |
| 644 | |
| 645 | @dataclass |
| 646 | class C: |
| 647 | x: int |
| 648 | y: int = 0 |
| 649 | z: int = field(init=False) |
| 650 | t: int = 10 |
| 651 | |
| 652 | self.assertNotIn('z', C(0).__dict__) |
| 653 | self.assertEqual(vars(C(5)), {'t': 10, 'x': 5, 'y': 0}) |
| 654 | |
| 655 | def test_class_marker(self): |
| 656 | @dataclass |
nothing calls this directly
no test coverage detected