mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
more docs
This commit is contained in:
@@ -115,22 +115,28 @@ def test_color_parse(text, expected):
|
||||
assert Color.parse(text) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("input,output", [
|
||||
("rgb( 300, 300 , 300 )", Color(255, 255, 255)),
|
||||
("rgba( 2 , 3 , 4, 1.0 )", Color(2, 3, 4, 1.0)),
|
||||
("hsl( 45, 25% , 25% )", Color(80, 72, 48)),
|
||||
("hsla( 45, 25% , 25%, 0.35 )", Color(80, 72, 48, 0.35)),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"input,output",
|
||||
[
|
||||
("rgb( 300, 300 , 300 )", Color(255, 255, 255)),
|
||||
("rgba( 2 , 3 , 4, 1.0 )", Color(2, 3, 4, 1.0)),
|
||||
("hsl( 45, 25% , 25% )", Color(80, 72, 48)),
|
||||
("hsla( 45, 25% , 25%, 0.35 )", Color(80, 72, 48, 0.35)),
|
||||
],
|
||||
)
|
||||
def test_color_parse_input_has_spaces(input, output):
|
||||
assert Color.parse(input) == output
|
||||
|
||||
|
||||
@pytest.mark.parametrize("input,output", [
|
||||
("rgb(300, 300, 300)", Color(255, 255, 255)),
|
||||
("rgba(300, 300, 300, 300)", Color(255, 255, 255, 1.0)),
|
||||
("hsl(400, 200%, 250%)", Color(255, 255, 255, 1.0)),
|
||||
("hsla(400, 200%, 250%, 1.9)", Color(255, 255, 255, 1.0)),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"input,output",
|
||||
[
|
||||
("rgb(300, 300, 300)", Color(255, 255, 255)),
|
||||
("rgba(300, 300, 300, 300)", Color(255, 255, 255, 1.0)),
|
||||
("hsl(400, 200%, 250%)", Color(255, 255, 255, 1.0)),
|
||||
("hsla(400, 200%, 250%, 1.9)", Color(255, 255, 255, 1.0)),
|
||||
],
|
||||
)
|
||||
def test_color_parse_clamp(input, output):
|
||||
assert Color.parse(input) == output
|
||||
|
||||
@@ -141,7 +147,8 @@ def test_color_parse_hsl_negative_degrees():
|
||||
|
||||
def test_color_parse_hsla_negative_degrees():
|
||||
assert Color.parse("hsla(-45, 50%, 50%, 0.2)") == Color.parse(
|
||||
"hsla(315, 50%, 50%, 0.2)")
|
||||
"hsla(315, 50%, 50%, 0.2)"
|
||||
)
|
||||
|
||||
|
||||
def test_color_parse_color():
|
||||
|
||||
Reference in New Issue
Block a user