(self)
| 963 | self.assertNotIn('x', D.__dict__) |
| 964 | |
| 965 | def test_missing_default_factory(self): |
| 966 | # Test that MISSING works the same as a default factory not |
| 967 | # being specified (which is really the same as a default not |
| 968 | # being specified, too). |
| 969 | @dataclass |
| 970 | class C: |
| 971 | x: int=field(default_factory=MISSING) |
| 972 | with self.assertRaisesRegex(TypeError, |
| 973 | r'__init__\(\) missing 1 required ' |
| 974 | 'positional argument'): |
| 975 | C() |
| 976 | self.assertNotIn('x', C.__dict__) |
| 977 | |
| 978 | @dataclass |
| 979 | class D: |
| 980 | x: int=field(default=MISSING, default_factory=MISSING) |
| 981 | with self.assertRaisesRegex(TypeError, |
| 982 | r'__init__\(\) missing 1 required ' |
| 983 | 'positional argument'): |
| 984 | D() |
| 985 | self.assertNotIn('x', D.__dict__) |
| 986 | |
| 987 | def test_missing_repr(self): |
| 988 | self.assertIn('MISSING_TYPE object', repr(MISSING)) |
nothing calls this directly
no test coverage detected