MCPcopy
hub / github.com/Textualize/rich / test_broken_str

Function test_broken_str

tests/test_traceback.py:236–248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

234
235
236def test_broken_str():
237 class BrokenStr(Exception):
238 def __str__(self):
239 1 / 0
240
241 console = Console(width=100, file=io.StringIO())
242 try:
243 raise BrokenStr()
244 except Exception:
245 console.print_exception()
246 result = console.file.getvalue()
247 print(result)
248 assert "<exception str() failed>" in result
249
250
251def test_guess_lexer():

Callers

nothing calls this directly

Calls 4

print_exceptionMethod · 0.95
ConsoleClass · 0.90
BrokenStrClass · 0.85
printFunction · 0.50

Tested by

no test coverage detected