diff --git a/tests/test_segment.py b/tests/test_segment.py new file mode 100644 index 00000000..719570a8 --- /dev/null +++ b/tests/test_segment.py @@ -0,0 +1,9 @@ +from rich.segment import Segment + + +def test_repr(): + assert repr(Segment("foo")) == "Segment('foo', None)" + + +def test_line(): + assert Segment.line() == Segment("\n") diff --git a/tests/test_style.py b/tests/test_style.py new file mode 100644 index 00000000..e1564050 --- /dev/null +++ b/tests/test_style.py @@ -0,0 +1,124 @@ +import pytest + +from rich.color import Color, ColorType +from rich import errors +from rich.style import Style, StyleStack + + +def test_str(): + assert str(Style()) == "none" + assert str(Style(bold=True)) == "bold" + assert str(Style(color="red", bold=True)) == "bold red" + assert ( + str( + Style( + color="red", + bgcolor="black", + bold=True, + dim=True, + italic=True, + underline=True, + blink=True, + blink2=True, + reverse=True, + conceal=True, + strike=True, + ) + ) + == "bold dim italic underline blink blink2 reverse conceal strike red on black" + ) + + +def test_repr(): + assert repr(Style(bold=True, color="red")) == '