MCPcopy Create free account
hub / github.com/ipython/ipython / test_basic_class

Function test_basic_class

IPython/lib/tests/test_pretty.py:259–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257
258
259def 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
277def test_collections_defaultdict():

Callers

nothing calls this directly

Calls 2

prettyMethod · 0.95
flushMethod · 0.45

Tested by

no test coverage detected