Skip to content

Commit 70cab38

Browse files
committed
refactor: split up pytest parameters
1 parent fbee330 commit 70cab38

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tests/test_unit/view/test_color.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@
2323

2424

2525
@pytest.mark.parametrize(
26-
"color",
26+
"value, expected",
2727
[
28-
{"value": "#ffffff", "expected": "#ffffff"},
29-
{"value": "#fff", "expected": "#ffffff"},
30-
{"value": "#f0f0f0", "expected": "#f0f0f0"},
31-
{"value": "#000", "expected": "#000000"},
32-
{"value": "#000000", "expected": "#000000"},
33-
{"value": "green", "expected": "#008000"},
34-
{"value": "white", "expected": "#ffffff"},
28+
("#ffffff", "#ffffff"),
29+
("#fff", "#ffffff"),
30+
("#f0f0f0", "#f0f0f0"),
31+
("#000", "#000000"),
32+
("#000000", "#000000"),
33+
("green", "#008000"),
34+
("white", "#ffffff"),
3535
pytest.param(
36-
{"value": "never-gonna-let-you-down", "expected": None},
36+
"never-gonna-let-you-down",
37+
"",
3738
marks=pytest.mark.raises(
3839
exception=pydantic.errors.ColorError,
3940
message=(
@@ -44,6 +45,6 @@
4445
),
4546
],
4647
)
47-
def test_code_element_init(color):
48-
"""Expect proper initialization from arguments."""
49-
assert str(Color(color["value"])) == color["expected"]
48+
def test_color_str_value(value: str, expected: str) -> None:
49+
"""Expect that the color string value is a six character hex code."""
50+
assert str(Color(value)) == expected

0 commit comments

Comments
 (0)