Skip to content

Commit

Permalink
Update the pytest.mark.parametrize arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Feb 21, 2025
1 parent b084fe0 commit 40b3208
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_conversions() -> None:


def test_all_empty_status() -> None:
for module in MODULES.values():
module.transversal_status_to_json(module.transversal_status_from_json({}))
for module_instance in MODULES.values():
module_instance.transversal_status_to_json(module_instance.transversal_status_from_json({}))


class ConfigDictModule(module.Module[dict[str, Any], None, None]):
Expand Down Expand Up @@ -120,9 +120,9 @@ class ConfigDataModule(module.Module[Data, None, None]):


@pytest.mark.parametrize(
"data,expected",
("data", "expected"),
[
[{"value": "test"}, Data(value="test")],
({"value": "test"}, Data(value="test")),
],
)
def test_data_configuration_from_json(data, expected) -> None:
Expand All @@ -136,9 +136,9 @@ class EventDataDataModule(module.Module[None, Data, None]):


@pytest.mark.parametrize(
"data,expected",
("data", "expected"),
[
[{"value": "test"}, Data(value="test")],
({"value": "test"}, Data(value="test")),
],
)
def test_data_event_data_from_json(data, expected) -> None:
Expand All @@ -147,7 +147,7 @@ def test_data_event_data_from_json(data, expected) -> None:
assert test_module.event_data_from_json(data) == expected


@pytest.mark.parametrize("data,expected", [[Data(value="test"), {"value": "test"}]])
@pytest.mark.parametrize(("data", "expected"), [(Data(value="test"), {"value": "test"})])
def test_data_event_data_to_json(data, expected) -> None:
test_module = EventDataDataModule()

Expand All @@ -159,9 +159,9 @@ class TransversalStatusDataModule(module.Module[None, None, Data]):


@pytest.mark.parametrize(
"data,expected",
("data", "expected"),
[
[{"value": "test"}, Data(value="test")],
({"value": "test"}, Data(value="test")),
],
)
def test_data_transversal_status_from_json(data, expected) -> None:
Expand All @@ -170,7 +170,7 @@ def test_data_transversal_status_from_json(data, expected) -> None:
assert test_module.transversal_status_from_json(data) == expected


@pytest.mark.parametrize("data,expected", [[Data(value="test"), {"value": "test"}]])
@pytest.mark.parametrize(("data", "expected"), [(Data(value="test"), {"value": "test"})])
def test_data_transversal_status_to_json(data, expected) -> None:
test_module = TransversalStatusDataModule()

Expand Down
10 changes: 5 additions & 5 deletions tests/test_module_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_get_transversal_dashboard() -> None:


@pytest.mark.parametrize(
"other_support, expected_color", [("01/01/2044", "--bs-danger"), ("01/01/2046", "--bs-body-bg")]
("other_support", "expected_color"), [("01/01/2044", "--bs-danger"), ("01/01/2046", "--bs-body-bg")]
)
def test_get_transversal_dashboard_repo_forward(other_support: str, expected_color: str) -> None:
versions = Versions()
Expand Down Expand Up @@ -465,7 +465,7 @@ def test_get_transversal_dashboard_repo_forward_inexisting() -> None:


@pytest.mark.parametrize(
"other_support, expected_color", [("01/01/2044", "--bs-body-bg"), ("01/01/2046", "--bs-danger")]
("other_support", "expected_color"), [("01/01/2044", "--bs-body-bg"), ("01/01/2046", "--bs-danger")]
)
def test_get_transversal_dashboard_repo_reverse(other_support: str, expected_color: str) -> None:
versions = Versions()
Expand Down Expand Up @@ -702,7 +702,7 @@ def test_get_transversal_dashboard_repo_external() -> None:

# parametrize
@pytest.mark.parametrize(
"datasource, package",
("datasource", "package"),
[
("pypi", "wring"),
("wrong", "test"),
Expand Down Expand Up @@ -743,7 +743,7 @@ def test_get_transversal_dashboard_repo_reverse_other(datasource: str, package:


@pytest.mark.parametrize(
"datasource, version, expected",
("datasource", "version", "expected"),
[
("docker", "1.2.3", "1.2.3"),
("other", "1.2.3", "1.2"),
Expand Down Expand Up @@ -1133,7 +1133,7 @@ def test_order_versions():


@pytest.mark.parametrize(
"support, dependency_support, expected_result",
("support", "dependency_support", "expected_result"),
[
("test", "test", True),
("other", "other", True),
Expand Down

0 comments on commit 40b3208

Please sign in to comment.