diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2022-02-21 17:11:37 +0100 |
---|---|---|
committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2022-02-21 17:30:23 +0100 |
commit | 45dcd671e362dd8d6e34db2dd1d03278e9d6584c (patch) | |
tree | 39035b83061f3bbc0efb000e2f608db90a5ab1a0 /numpy/typing | |
parent | 3a3125caa3114b51c428b7992436807f8b5c90ed (diff) | |
download | numpy-45dcd671e362dd8d6e34db2dd1d03278e9d6584c.tar.gz |
TYP,TST: Add tests for known mypy-related false-positives
These all concern known false positives due to known mypy bugs. If one of these tests break, than that would generally be indicative of a upstream bug fix
Diffstat (limited to 'numpy/typing')
-rw-r--r-- | numpy/typing/tests/data/fail/false_positives.pyi | 11 | ||||
-rw-r--r-- | numpy/typing/tests/data/reveal/false_positives.pyi | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/numpy/typing/tests/data/fail/false_positives.pyi b/numpy/typing/tests/data/fail/false_positives.pyi new file mode 100644 index 000000000..7e7923066 --- /dev/null +++ b/numpy/typing/tests/data/fail/false_positives.pyi @@ -0,0 +1,11 @@ +import numpy as np +import numpy.typing as npt + +AR_f8: npt.NDArray[np.float64] + +# NOTE: Mypy bug presumably due to the special-casing of heterogeneous tuples; +# xref numpy/numpy#20901 +# +# The expected output should be no different than, e.g., when using a +# list instead of a tuple +np.concatenate(([1], AR_f8)) # E: Argument 1 to "concatenate" has incompatible type diff --git a/numpy/typing/tests/data/reveal/false_positives.pyi b/numpy/typing/tests/data/reveal/false_positives.pyi new file mode 100644 index 000000000..2d7156642 --- /dev/null +++ b/numpy/typing/tests/data/reveal/false_positives.pyi @@ -0,0 +1,10 @@ +from typing import Any +import numpy.typing as npt + +AR_Any: npt.NDArray[Any] + +# Mypy bug where overload ambiguity is ignored for `Any`-parametrized types; +# xref numpy/numpy#20099 and python/mypy#11347 +# +# The expected output would be something akin to `ndarray[Any, dtype[Any]]` +reveal_type(AR_Any + 2) # E: ndarray[Any, dtype[signedinteger[Any]]] |