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

Function test_error_pretty_method

IPython/core/tests/test_formatters.py:276–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

274 nt.assert_in("name_error", captured.stdout)
275
276def test_error_pretty_method():
277 f = PlainTextFormatter()
278 class BadPretty(object):
279 def _repr_pretty_(self):
280 return "hello"
281 bad = BadPretty()
282 with capture_output() as captured:
283 result = f(bad)
284 nt.assert_is(result, None)
285 nt.assert_in("Traceback", captured.stdout)
286 nt.assert_in("_repr_pretty_", captured.stdout)
287 nt.assert_in("given", captured.stdout)
288 nt.assert_in("argument", captured.stdout)
289
290
291def test_bad_repr_traceback():

Callers

nothing calls this directly

Calls 4

PlainTextFormatterClass · 0.90
BadPrettyClass · 0.85
capture_outputClass · 0.85
fFunction · 0.70

Tested by

no test coverage detected