mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix test
This commit is contained in:
@@ -4,8 +4,7 @@ import pytest
|
||||
|
||||
|
||||
from textual.color import Color
|
||||
from textual.css.errors import UnresolvedVariableError
|
||||
from textual.css.parse import substitute_references
|
||||
from textual.css.parse import substitute_references, TokenError
|
||||
from textual.css.scalar import Scalar, Unit
|
||||
from textual.css.stylesheet import Stylesheet, StylesheetParseError
|
||||
from textual.css.tokenize import tokenize
|
||||
@@ -214,7 +213,7 @@ class TestVariableReferenceSubstitution:
|
||||
|
||||
def test_undefined_variable(self):
|
||||
css = ".thing { border: $not-defined; }"
|
||||
with pytest.raises(UnresolvedVariableError):
|
||||
with pytest.raises(TokenError):
|
||||
list(substitute_references(tokenize(css, "")))
|
||||
|
||||
def test_transitive_reference(self):
|
||||
@@ -907,7 +906,9 @@ class TestParseText:
|
||||
class TestParseColor:
|
||||
"""More in-depth tests around parsing of CSS colors"""
|
||||
|
||||
@pytest.mark.parametrize("value,result", [
|
||||
@pytest.mark.parametrize(
|
||||
"value,result",
|
||||
[
|
||||
("rgb(1,255,50)", Color(1, 255, 50)),
|
||||
("rgb( 1, 255,50 )", Color(1, 255, 50)),
|
||||
("rgba( 1, 255,50,0.3 )", Color(1, 255, 50, 0.3)),
|
||||
@@ -917,7 +918,8 @@ class TestParseColor:
|
||||
("hsla(180,50%,50%,0.25)", Color(64, 191, 191, 0.25)),
|
||||
("hsla( 180, 50% ,50%,0.25 )", Color(64, 191, 191, 0.25)),
|
||||
("hsla( 180, 50% , 50% , 1.5 )", Color(64, 191, 191)),
|
||||
])
|
||||
],
|
||||
)
|
||||
def test_rgb_and_hsl(self, value, result):
|
||||
css = f""".box {{
|
||||
color: {value};
|
||||
@@ -1021,6 +1023,7 @@ class TestParseOverflow:
|
||||
assert styles.overflow_x == "hidden"
|
||||
assert styles.overflow_y == "auto"
|
||||
|
||||
|
||||
class TestParseTransition:
|
||||
@pytest.mark.parametrize(
|
||||
"duration, parsed_duration",
|
||||
|
||||
Reference in New Issue
Block a user