Closed hiker closed 1 month ago
OK, the error is not detected because the function isn't type (--> mypy ignores it). Adding --> None
:
def test_artefact_store_copy() -> None:
then results in:
$ mypy source/ tests/unit_tests/test_artefacts.py
tests/unit_tests/test_artefacts.py:38: error: Argument 2 to "add" of "ArtefactStore" has incompatible type "Path"; expected "str | list[str] | set[str]" [arg-type]
tests/unit_tests/test_artefacts.py:42: error: List item 0 has incompatible type "Path"; expected "str" [list-item]
tests/unit_tests/test_artefacts.py:42: error: List item 1 has incompatible type "Path"; expected "str" [list-item]
tests/unit_tests/test_artefacts.py:43: error: List item 0 has incompatible type "Path"; expected "str" [list-item]
tests/unit_tests/test_artefacts.py:43: error: List item 1 has incompatible type "Path"; expected "str" [list-item]
Trying to consistently fix this in this test raises a lot of mypy warnings :(
Migrated to new repo.
As commented by @jasonjunweilyu :
A quick change of using strs fails:
And strange, if I try to prevent from strings being used (specifying Path instead of str as parameters do
add
in the ArtefactStore), the string is still accepted without any error. And confusingly: why is mypy quiet about providing a Path where the parameter is supposed to be a string??