8000 ENH: Refactor the typing "reveal" tests using `typing.assert_type` by BvB93 · Pull Request #24637 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Refactor the typing "reveal" tests using typing.assert_type #24637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TYP: Bump mypy to 1.5.1
  • Loading branch information
BvB93 committed Sep 4, 2023
commit c141c2b605c0d64eac01a95dfbad6bf08efd5397
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- hypothesis
# For type annotations
- typing_extensions>=4.2.0 # needed for python < 3.10
- mypy=1.4.1
- mypy=1.5.1
# For building docs
- sphinx>=4.5.0
- sphinx-design
Expand Down
10 changes: 5 additions & 5 deletions numpy/typing/tests/data/fail/lib_polynomial.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ AR_U: npt.NDArray[np.str_]

poly_obj: np.poly1d

np.polymul(AR_f8, AR_U) # E: incompatible type
np.polydiv(AR_f8, AR_U) # E: incompatible type

5**poly_obj # E: No overload variant

np.polyint(AR_U) # E: incompatible type
np.polyint(AR_f8, m=1j) # E: No overload variant

Expand All @@ -22,8 +27,3 @@ np.polyfit(AR_f8, AR_f8, 1, cov="bob") # E: No overload variant
np.polyval(AR_f8, AR_U) # E: incompatible type
np.polyadd(AR_f8, AR_U) # E: incompatible type
np.polysub(AR_f8, AR_U) # E: incompatible type
np.polymul(AR_f8, AR_U) # E: incompatible type
np.polydiv(AR_f8, AR_U) # E: incompatible type

5**poly_obj # E: No overload variant
hash(poly_obj)
2 changes: 1 addition & 1 deletion numpy/typing/tests/data/reveal/arithmetic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ assert_type(i8 + AR_f, npt.NDArray[np.floating[Any]])

assert_type(u8 + u8, np.uint64)
assert_type(u8 + i4, Any)
assert_type(u8 + u4, np.signedinteger[_32Bit | _64Bit])
assert_type(u8 + u4, np.unsignedinteger[_32Bit | _64Bit])
assert_type(u8 + b_, np.uint64)
assert_type(u8 + b, np.uint64)
assert_type(u8 + c, np.complex128)
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cffi; python_version < '3.10'
# For testing types. Notes on the restrictions:
# - Mypy relies on C API features not present in PyPy
# NOTE: Keep mypy in sync with environment.yml
mypy==1.4.1; platform_python_implementation != "PyPy"
mypy==1.5.1; platform_python_implementation != "PyPy"
typing_extensions>=4.2.0
# for optional f2py encoding detection
charset-normalizer
0