Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jun 18, 2021
1 parent 56b4c53 commit 6e97016
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down
14 changes: 14 additions & 0 deletions tests/test_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[/]")
2 changes: 1 addition & 1 deletion tests/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __rich_repr__(self):

@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
Expand Down

0 comments on commit 6e97016

Please sign in to comment.