Exemple #1
0
def test_rich_console(live_render):
    options = ConsoleOptions(
        legacy_windows=False,
        min_width=10,
        max_width=20,
        is_terminal=False,
        encoding="utf-8",
    )
    rich_console = live_render.__rich_console__(Console(), options)
    assert [Segment.control("my string", Style.parse("none"))] == list(rich_console)
    live_render.style = "red"
    rich_console = live_render.__rich_console__(Console(), options)
    assert [Segment.control("my string", Style.parse("red"))] == list(rich_console)
Exemple #2
0
def test_repr():
    assert repr(Segment("foo")) == "Segment('foo', None)"
    assert repr(Segment.control("foo")) == "Segment.control('foo', None)"