(self)
| 2167 | self.assertEqual(c.new_method(), 1.0) |
| 2168 | |
| 2169 | def test_generic_dynamic(self): |
| 2170 | T = TypeVar('T') |
| 2171 | |
| 2172 | @dataclass |
| 2173 | class Parent(Generic[T]): |
| 2174 | x: T |
| 2175 | Child = make_dataclass('Child', [('y', T), ('z', Optional[T], None)], |
| 2176 | bases=(Parent[int], Generic[T]), namespace={'other': 42}) |
| 2177 | self.assertIs(Child[int](1, 2).z, None) |
| 2178 | self.assertEqual(Child[int](1, 2, 3).z, 3) |
| 2179 | self.assertEqual(Child[int](1, 2, 3).other, 42) |
| 2180 | # Check that type aliases work correctly. |
| 2181 | Alias = Child[T] |
| 2182 | self.assertEqual(Alias[int](1, 2).x, 1) |
| 2183 | # Check MRO resolution. |
| 2184 | self.assertEqual(Child.__mro__, (Child, Parent, Generic, object)) |
| 2185 | |
| 2186 | def test_dataclasses_pickleable(self): |
| 2187 | global P, Q, R |
nothing calls this directly
no test coverage detected