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

Function test_title_text

tests/test_panel.py:105–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103
104
105def test_title_text() -> None:
106 panel = Panel(
107 "Hello, World",
108 title=Text("title", style="red"),
109 subtitle=Text("subtitle", style="magenta bold"),
110 )
111 console = Console(
112 file=io.StringIO(),
113 width=50,
114 height=20,
115 legacy_windows=False,
116 force_terminal=True,
117 color_system="truecolor",
118 )
119 console.print(panel)
120
121 result = console.file.getvalue()
122 print(repr(result))
123 expected = "╭────────────────────\x1b[31m title \x1b[0m─────────────────────╮\n│ Hello, World │\n╰───────────────────\x1b[1;35m subtitle \x1b[0m───────────────────╯\n"
124 assert result == expected
125
126
127def test_title_text_with_border_color() -> None:

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