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

Function test_recursive_exception

tests/test_traceback.py:378–399  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/3708 Test this doesn't create an infinite loop.

()

Source from the content-addressed store, hash-verified

376
377
378def test_recursive_exception() -> None:
379 """Regression test for https://github.com/Textualize/rich/issues/3708
380
381 Test this doesn't create an infinite loop.
382
383 """
384 console = Console()
385
386 def foo() -> None:
387 try:
388 raise RuntimeError("Hello")
389 except Exception as e:
390 raise e from e
391
392 def bar() -> None:
393 try:
394 foo()
395 except Exception as e:
396 assert e is e.__cause__
397 console.print_exception(show_locals=True)
398
399 bar()

Callers

nothing calls this directly

Calls 2

ConsoleClass · 0.90
barFunction · 0.70

Tested by

no test coverage detected