(self)
| 291 | self.assertEqual(pprint.saferepr(simple), native) |
| 292 | |
| 293 | def test_container_repr_override_called(self): |
| 294 | N = 1000 |
| 295 | # Ensure that __repr__ override is called for subclasses of containers |
| 296 | |
| 297 | for cont in (list_custom_repr(), |
| 298 | list_custom_repr([1,2,3]), |
| 299 | list_custom_repr(range(N)), |
| 300 | tuple_custom_repr(), |
| 301 | tuple_custom_repr([1,2,3]), |
| 302 | tuple_custom_repr(range(N)), |
| 303 | set_custom_repr(), |
| 304 | set_custom_repr([1,2,3]), |
| 305 | set_custom_repr(range(N)), |
| 306 | frozenset_custom_repr(), |
| 307 | frozenset_custom_repr([1,2,3]), |
| 308 | frozenset_custom_repr(range(N)), |
| 309 | dict_custom_repr(), |
| 310 | dict_custom_repr({5: 6}), |
| 311 | dict_custom_repr(zip(range(N),range(N))), |
| 312 | mappingview_custom_repr({}), |
| 313 | mappingview_custom_repr({5: 6}), |
| 314 | mappingview_custom_repr(dict(zip(range(N),range(N)))), |
| 315 | keysview_custom_repr({}), |
| 316 | keysview_custom_repr({5: 6}), |
| 317 | keysview_custom_repr(dict(zip(range(N),range(N)))), |
| 318 | ): |
| 319 | native = repr(cont) |
| 320 | expected = '*' * len(native) |
| 321 | self.assertEqual(pprint.pformat(cont), expected) |
| 322 | self.assertEqual(pprint.pformat(cont, width=1, indent=0), expected) |
| 323 | self.assertEqual(pprint.saferepr(cont), expected) |
| 324 | |
| 325 | def test_basic_line_wrap(self): |
| 326 | # verify basic line-wrapping operation |
nothing calls this directly
no test coverage detected