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

Function test_title_text_with_panel_background

tests/test_panel.py:151–172  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/3569

()

Source from the content-addressed store, hash-verified

149
150
151def test_title_text_with_panel_background() -> None:
152 """Regression test for https://github.com/Textualize/rich/issues/3569"""
153 panel = Panel(
154 "Hello, World",
155 style="on blue",
156 title=Text("title", style="red"),
157 subtitle=Text("subtitle", style="magenta bold"),
158 )
159 console = Console(
160 file=io.StringIO(),
161 width=50,
162 height=20,
163 legacy_windows=False,
164 force_terminal=True,
165 color_system="truecolor",
166 )
167 console.print(panel)
168
169 result = console.file.getvalue()
170 print(repr(result))
171 expected = "\x1b[44m╭─\x1b[0m\x1b[44m───────────────────\x1b[0m\x1b[31;44m title \x1b[0m\x1b[44m────────────────────\x1b[0m\x1b[44m─╮\x1b[0m\n\x1b[44m│\x1b[0m\x1b[44m \x1b[0m\x1b[44mHello, World\x1b[0m\x1b[44m \x1b[0m\x1b[44m \x1b[0m\x1b[44m│\x1b[0m\n\x1b[44m╰─\x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[1;35;44m subtitle \x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[44m─╯\x1b[0m\n"
172 assert result == expected
173
174
175if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

printMethod · 0.95
PanelClass · 0.90
TextClass · 0.90
ConsoleClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected