mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Update tests.
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
from rich.style import Style
|
|
||||||
|
|
||||||
from textual.css.styles import Styles
|
|
||||||
|
|
||||||
|
|
||||||
def test_text_style_none():
|
|
||||||
styles = Styles()
|
|
||||||
styles.text_style = "none"
|
|
||||||
assert styles.text_style == Style()
|
|
||||||
|
|
||||||
|
|
||||||
def test_text_style_none_with_others():
|
|
||||||
"""Style "none" mixed with others should result in empty style."""
|
|
||||||
styles = Styles()
|
|
||||||
styles.text_style = "bold none underline italic"
|
|
||||||
|
|
||||||
none_styles = Styles()
|
|
||||||
styles.text_style = "none"
|
|
||||||
|
|
||||||
assert styles.text_style == none_styles.text_style
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
|
import pytest
|
||||||
|
from rich.style import Style
|
||||||
|
|
||||||
from textual.color import Color
|
from textual.color import Color
|
||||||
|
from textual.css.errors import StyleValueError
|
||||||
from textual.css.styles import Styles
|
from textual.css.styles import Styles
|
||||||
|
|
||||||
|
|
||||||
@@ -7,3 +11,12 @@ def test_box_normalization():
|
|||||||
styles = Styles()
|
styles = Styles()
|
||||||
styles.border_left = ("none", "red")
|
styles.border_left = ("none", "red")
|
||||||
assert styles.border_left == ("", Color.parse("red"))
|
assert styles.border_left == ("", Color.parse("red"))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("style_attr", ["text_style", "link_style"])
|
||||||
|
def test_text_style_none_with_others(style_attr):
|
||||||
|
"""Style "none" mixed with others should give custom Textual exception."""
|
||||||
|
styles = Styles()
|
||||||
|
|
||||||
|
with pytest.raises(StyleValueError) as exc_info:
|
||||||
|
setattr(styles, style_attr, "bold none underline italic")
|
||||||
|
|||||||
Reference in New Issue
Block a user