(self)
| 942 | ) |
| 943 | |
| 944 | def test_missing_default(self): |
| 945 | # Test that MISSING works the same as a default not being |
| 946 | # specified. |
| 947 | @dataclass |
| 948 | class C: |
| 949 | x: int=field(default=MISSING) |
| 950 | with self.assertRaisesRegex(TypeError, |
| 951 | r'__init__\(\) missing 1 required ' |
| 952 | 'positional argument'): |
| 953 | C() |
| 954 | self.assertNotIn('x', C.__dict__) |
| 955 | |
| 956 | @dataclass |
| 957 | class D: |
| 958 | x: int |
| 959 | with self.assertRaisesRegex(TypeError, |
| 960 | r'__init__\(\) missing 1 required ' |
| 961 | 'positional argument'): |
| 962 | D() |
| 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 |
nothing calls this directly
no test coverage detected