Skip to content

Commit e28a775

Browse files
Fix test typing
Previously there was a test which violated type-hints. As we can not keep having the test _and_ type hints on that test, the test itself was rewritten to test a semantically slightly different but similar edge case. The original test case is of course prevented when using type-hints (i.e not passing `None` to a function that doesn't accept `None`) Signed-off-by: Florian Wagner <[email protected]>
1 parent 7a26a31 commit e28a775

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/config/test_util.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ def test_load_config_dataclass(
5454
[SimpleConfig, MmSimpleConfig],
5555
ids=["dataclass", "marshmallow_dataclass"],
5656
)
57-
def test_load_config_load_None(
57+
@pytest.mark.parametrize("config", [dict(), None], ids=["empty", "none"])
58+
def test_load_config_load_empty(
5859
config_class: type[SimpleConfig] | type[MmSimpleConfig],
60+
config: dict[str, Any] | None,
5961
) -> None:
60-
"""Test that load_config raises ValidationError if the configuration is None."""
61-
config: dict[str, Any] = {}
62+
"""Test that load_config raises ValidationError if the configuration is empty."""
6263
with pytest.raises(marshmallow.ValidationError):
63-
_ = load_config(config_class, config.get("loggers", None))
64+
_ = load_config(config_class, config) # type: ignore[arg-type]
6465

6566

6667
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)