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

Function test_cast_recursive

tests/test_protocol.py:67–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65
66
67def test_cast_recursive():
68 class B:
69 def __rich__(self) -> "A":
70 return A()
71
72 def __repr__(self) -> str:
73 return "<B>"
74
75 class A:
76 def __rich__(self) -> B:
77 return B()
78
79 def __repr__(self) -> str:
80 return "<A>"
81
82 console = Console(file=io.StringIO())
83 console.print(A())
84 assert console.file.getvalue() == "<B>\n"

Callers

nothing calls this directly

Calls 3

printMethod · 0.95
ConsoleClass · 0.90
AClass · 0.85

Tested by

no test coverage detected