From 6e97016e22c291e0fa0b20cb648de6d8cfc96ac7 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 18 Jun 2021 20:37:33 +0100 Subject: [PATCH] test fix --- tests/test_color.py | 4 ++++ tests/test_markup.py | 14 ++++++++++++++ tests/test_repr.py | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_color.py b/tests/test_color.py index 389c00ed..796f0198 100644 --- a/tests/test_color.py +++ b/tests/test_color.py @@ -21,6 +21,10 @@ def test_repr() -> None: assert repr(Color.parse("red")) == "Color('red', ColorType.STANDARD, number=1)" +def test_color_system_repr() -> None: + assert repr(ColorSystem.EIGHT_BIT) == "ColorSystem.EIGHT_BIT" + + def test_rich() -> None: color = Color.parse("red") as_text = color.__rich__() diff --git a/tests/test_markup.py b/tests/test_markup.py index 07c16425..0f7061c4 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -149,3 +149,17 @@ def test_escape_escape(): result = render(r"\\\\") assert str(result) == r"\\\\" + + +def test_events(): + + result = render("[@click]Hello[/@click] [@click='view.toggle', 'left']World[/]") + assert str(result) == "Hello World" + + +def test_events_broken(): + with pytest.raises(MarkupError): + render("[@click=sdfwer]foo[/]") + + with pytest.raises(MarkupError): + render("[@click='view.toggle]foo[/]") diff --git a/tests/test_repr.py b/tests/test_repr.py index c41de992..c4f8bd09 100644 --- a/tests/test_repr.py +++ b/tests/test_repr.py @@ -21,7 +21,7 @@ class Foo: @rich.repr.auto class Egg: - def __init__(self, foo: str, /, bar: Optional[int] = None, egg: int = 1): + def __init__(self, foo: str, bar: Optional[int] = None, egg: int = 1): self.foo = foo self.bar = bar self.egg = egg