| 257 | |
| 258 | |
| 259 | def test_basic_class(): |
| 260 | def type_pprint_wrapper(obj, p, cycle): |
| 261 | if obj is MyObj: |
| 262 | type_pprint_wrapper.called = True |
| 263 | return pretty._type_pprint(obj, p, cycle) |
| 264 | type_pprint_wrapper.called = False |
| 265 | |
| 266 | stream = StringIO() |
| 267 | printer = pretty.RepresentationPrinter(stream) |
| 268 | printer.type_pprinters[type] = type_pprint_wrapper |
| 269 | printer.pretty(MyObj) |
| 270 | printer.flush() |
| 271 | output = stream.getvalue() |
| 272 | |
| 273 | nt.assert_equal(output, '%s.MyObj' % __name__) |
| 274 | nt.assert_true(type_pprint_wrapper.called) |
| 275 | |
| 276 | |
| 277 | def test_collections_defaultdict(): |