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

Function test_render_size

tests/test_panel.py:61–102  ·  tests/test_panel.py::test_render_size
()

Source from the content-addressed store, hash-verified

59
60
61def test_render_size() -> None:
62 console = Console(width=63, height=46, legacy_windows=False)
63 options = console.options.update_dimensions(80, 4)
64 lines = console.render_lines(Panel(class="st">"foo", title=class="st">"Hello"), options=options)
65 print(repr(lines))
66 expected = [
67 [
68 Segment(class="st">"╭─", Style()),
69 Segment(
70 class="st">"────────────────────────────────── Hello ───────────────────────────────────"
71 ),
72 Segment(class="st">"─╮", Style()),
73 ],
74 [
75 Segment(class="st">"│", Style()),
76 Segment(class="st">" ", Style()),
77 Segment(class="st">"foo"),
78 Segment(
79 class="st">" ",
80 Style(),
81 ),
82 Segment(class="st">" ", Style()),
83 Segment(class="st">"│", Style()),
84 ],
85 [
86 Segment(class="st">"│", Style()),
87 Segment(class="st">" ", Style()),
88 Segment(
89 class="st">" ",
90 Style(),
91 ),
92 Segment(class="st">" ", Style()),
93 Segment(class="st">"│", Style()),
94 ],
95 [
96 Segment(
97 class="st">"╰──────────────────────────────────────────────────────────────────────────────╯",
98 Style(),
99 )
100 ],
101 ]
102 assert lines == expected
103
104
105def test_title_text() -> None:

Callers

nothing calls this directly

Calls 7

render_linesMethod · 0.95
ConsoleClass · 0.90
PanelClass · 0.90
SegmentClass · 0.90
StyleClass · 0.90
update_dimensionsMethod · 0.80
printFunction · 0.50

Tested by

no test coverage detected