(self)
| 4428 | self.assertEqual(C.z, 20) |
| 4429 | |
| 4430 | def test_other_params(self): |
| 4431 | C = make_dataclass('C', |
| 4432 | [('x', int), |
| 4433 | ('y', ClassVar[int], 10), |
| 4434 | ('z', ClassVar[int], field(default=20)), |
| 4435 | ], |
| 4436 | init=False) |
| 4437 | # Make sure we have a repr, but no init. |
| 4438 | self.assertNotIn('__init__', vars(C)) |
| 4439 | self.assertIn('__repr__', vars(C)) |
| 4440 | |
| 4441 | # Make sure random other params don't work. |
| 4442 | with self.assertRaisesRegex(TypeError, 'unexpected keyword argument'): |
| 4443 | C = make_dataclass('C', |
| 4444 | [], |
| 4445 | xxinit=False) |
| 4446 | |
| 4447 | def test_no_types(self): |
| 4448 | C = make_dataclass('Point', ['x', 'y', 'z']) |
nothing calls this directly
no test coverage detected