(self)
| 4402 | self.assertEqual((c.x, c.y), (1, 2)) |
| 4403 | |
| 4404 | def test_init_var(self): |
| 4405 | def post_init(self, y): |
| 4406 | self.x *= y |
| 4407 | |
| 4408 | C = make_dataclass('C', |
| 4409 | [('x', int), |
| 4410 | ('y', InitVar[int]), |
| 4411 | ], |
| 4412 | namespace={'__post_init__': post_init}, |
| 4413 | ) |
| 4414 | c = C(2, 3) |
| 4415 | self.assertEqual(vars(c), {'x': 6}) |
| 4416 | self.assertEqual(len(fields(c)), 1) |
| 4417 | |
| 4418 | def test_class_var(self): |
| 4419 | C = make_dataclass('C', |
nothing calls this directly
no test coverage detected