| 292 | |
| 293 | |
| 294 | def test_basic_class(): |
| 295 | def type_pprint_wrapper(obj, p, cycle): |
| 296 | if obj is MyObj: |
| 297 | type_pprint_wrapper.called = True |
| 298 | return pretty._type_pprint(obj, p, cycle) |
| 299 | |
| 300 | type_pprint_wrapper.called = False |
| 301 | |
| 302 | stream = StringIO() |
| 303 | printer = pretty.RepresentationPrinter(stream) |
| 304 | printer.type_pprinters[type] = type_pprint_wrapper |
| 305 | printer.pretty(MyObj) |
| 306 | printer.flush() |
| 307 | output = stream.getvalue() |
| 308 | |
| 309 | assert output == "%s.MyObj" % __name__ |
| 310 | assert type_pprint_wrapper.called is True |
| 311 | |
| 312 | |
| 313 | def test_collections_userlist(): |