more docs

This commit is contained in:
Will McGugan
2022-07-30 17:01:51 +01:00
parent 7ba36c1146
commit 7040d00c7b
22 changed files with 534 additions and 31 deletions

View File

@@ -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():