(self)
| 287 | self.assertRaises(TypeError, tp, a=1, b=2) |
| 288 | |
| 289 | def test_repr(self): |
| 290 | args = (object(), object()) |
| 291 | args_repr = ', '.join(repr(a) for a in args) |
| 292 | kwargs = {'a': object(), 'b': object()} |
| 293 | kwargs_reprs = ['a={a!r}, b={b!r}'.format_map(kwargs), |
| 294 | 'b={b!r}, a={a!r}'.format_map(kwargs)] |
| 295 | name = f"{self.partial.__module__}.{self.partial.__qualname__}" |
| 296 | |
| 297 | f = self.partial(capture) |
| 298 | self.assertEqual(f'{name}({capture!r})', repr(f)) |
| 299 | |
| 300 | f = self.partial(capture, *args) |
| 301 | self.assertEqual(f'{name}({capture!r}, {args_repr})', repr(f)) |
| 302 | |
| 303 | f = self.partial(capture, **kwargs) |
| 304 | self.assertIn(repr(f), |
| 305 | [f'{name}({capture!r}, {kwargs_repr})' |
| 306 | for kwargs_repr in kwargs_reprs]) |
| 307 | |
| 308 | f = self.partial(capture, *args, **kwargs) |
| 309 | self.assertIn(repr(f), |
| 310 | [f'{name}({capture!r}, {args_repr}, {kwargs_repr})' |
| 311 | for kwargs_repr in kwargs_reprs]) |
| 312 | |
| 313 | def test_recursive_repr(self): |
| 314 | name = f"{self.partial.__module__}.{self.partial.__qualname__}" |
nothing calls this directly
no test coverage detected