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

Function test_reference_cycle_container

tests/test_pretty.py:312–327  ·  tests/test_pretty.py::test_reference_cycle_container
()

Source from the content-addressed store, hash-verified

310
311
312def test_reference_cycle_container() -> None:
313 test = []
314 test.append(test)
315 res = pretty_repr(test)
316 assert res == class="st">"[...]"
317
318 test = [1, []]
319 test[1].append(test)
320 res = pretty_repr(test)
321 assert res == class="st">"[1, [...]]"
322
323 class="cm"># Not a cyclic reference, just a repeated reference
324 a = [2]
325 test = [1, [a, a]]
326 res = pretty_repr(test)
327 assert res == class="st">"[1, [[2], [2]]]"
328
329
330def test_reference_cycle_namedtuple() -> None:

Callers

nothing calls this directly

Calls 2

pretty_reprFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected