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

Function test_rich_console

tests/test_padding.py:38–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36
37
38def test_rich_console():
39 renderable = "test renderable"
40 style = Style(color="red")
41 options = ConsoleOptions(
42 ConsoleDimensions(80, 25),
43 max_height=25,
44 legacy_windows=False,
45 min_width=10,
46 max_width=20,
47 is_terminal=False,
48 encoding="utf-8",
49 )
50
51 expected_outputs = [
52 Segment(renderable, style=style),
53 Segment(" " * (20 - len(renderable)), style=style),
54 Segment("\n", style=None),
55 ]
56 padding_generator = Padding(renderable, style=style).__rich_console__(
57 Console(), options
58 )
59 for output, expected in zip(padding_generator, expected_outputs):
60 assert output == expected

Callers

nothing calls this directly

Calls 7

StyleClass · 0.90
ConsoleOptionsClass · 0.90
ConsoleDimensionsClass · 0.90
SegmentClass · 0.90
PaddingClass · 0.90
ConsoleClass · 0.90
__rich_console__Method · 0.45

Tested by

no test coverage detected