Skip to content

♻️ improve test consistency #385

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 1 commit into from
Mar 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
34 changes: 17 additions & 17 deletions test/static/reject/array_constructors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import numpy.typing as npt
a: npt.NDArray[np.float64]
generator = (i for i in range(10))

np.require(a, requirements=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.require(a, requirements="TEST") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.require(a, requirements=1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.require(a, requirements="TEST") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.zeros("test") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.zeros("test") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.zeros() # type: ignore[call-overload] # pyright: ignore[reportCallIssue]

np.ones("test") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.ones("test") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.ones() # type: ignore[call-overload] # pyright: ignore[reportCallIssue]

np.array(0, float, True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue]

np.linspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(0, 2, num=10.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(0, 2, endpoint="True") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(0, 2, retstep=b"False") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(0, 2, dtype=0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(0, 2, axis=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.linspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.linspace(0, 2, num=10.0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.linspace(0, 2, endpoint="True") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.linspace(0, 2, retstep=b"False") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.linspace(0, 2, dtype=0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.linspace(0, 2, axis=None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]

np.logspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.logspace(0, 2, base=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.logspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.logspace(0, 2, base=None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]

np.geomspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.geomspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]

np.stack(generator) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.hstack({1, 2}) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.vstack(1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.stack(generator) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.hstack({1, 2}) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.vstack(1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]

np.array([1], like=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.array([1], like=1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
2 changes: 1 addition & 1 deletion test/static/reject/array_pad.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import numpy.typing as npt

AR_i8: npt.NDArray[np.int64]

np.pad(AR_i8, 2, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.pad(AR_i8, 2, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
2 changes: 1 addition & 1 deletion test/static/reject/arrayprint.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AR: npt.NDArray[np.float64]
func1: Callable[[Any], str]
func2: Callable[[np.integer], str]

np.array2string(AR, style=None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue]
np.array2string(AR, style=None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.array2string(AR, legacy="1.14") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
np.array2string(AR, sign="*") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
np.array2string(AR, floatmode="default") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
Expand Down
64 changes: 32 additions & 32 deletions test/static/reject/char.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,45 @@ np.char.less(AR_S, AR_U, dtype=int) # type: ignore[arg-type] # pyright: ignore
np.char.encode(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
np.char.decode(AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]

np.char.join(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.join(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.join(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.join(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.strip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.lstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.strip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.lstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.strip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.lstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.strip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.lstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.partition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rpartition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.partition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rpartition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.partition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rpartition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.partition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rpartition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.replace(AR_U, b"_", b"-") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.replace(AR_S, "_", "-") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.replace(AR_U, b"_", b"-") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.replace(AR_S, "_", "-") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.split(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rsplit(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.split(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rsplit(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.split(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rsplit(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.split(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rsplit(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.count(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.count(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.count(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.count(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.endswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.startswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.endswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.startswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.endswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.startswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.endswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.startswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.find(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rfind(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.find(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rfind(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.find(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rfind(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.find(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rfind(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

np.char.index(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rindex(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.index(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.rindex(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.char.index(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rindex(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.index(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.char.rindex(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
6 changes: 3 additions & 3 deletions test/static/reject/dtype.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ t3: dict[str, tuple[type[int | float], int]]

###

np.dtype(t1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.dtype(t2) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.dtype(t3) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.dtype(t1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
np.dtype(t2) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.dtype(t3) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
8 changes: 4 additions & 4 deletions test/static/reject/einsumfunc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AR_U: npt.NDArray[np.str_]

###

np.einsum("i,i->i", AR_i, AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType]
np.einsum("i,i->i", AR_i, AR_i, out=AR_U) # type: ignore[type-var] # pyright: ignore[reportCallIssue,reportArgumentType]
np.einsum("i,i->i", AR_i, AR_i, out=AR_U, casting="unsafe") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
np.einsum("i,i->i", AR_i, AR_m) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
np.einsum("i,i->i", AR_i, AR_i, out=AR_U) # type: ignore[type-var] # pyright: ignore[reportArgumentType, reportCallIssue]
np.einsum("i,i->i", AR_i, AR_i, out=AR_U, casting="unsafe") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
6 changes: 3 additions & 3 deletions test/static/reject/flatiter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ a.index = 0 # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue]

a.copy(order="C") # type: ignore[call-arg] # pyright: ignore[reportCallIssue]

a[np.True_] # type: ignore[index] # pyright: ignore[reportCallIssue,reportArgumentType]
a[ix] # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]
a[supports_array] # type: ignore[index] # pyright: ignore[reportCallIssue,reportArgumentType]
a[np.True_] # type: ignore[index] # pyright: ignore[reportArgumentType, reportCallIssue]
a[ix] # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
a[supports_array] # type: ignore[index] # pyright: ignore[reportArgumentType, reportCallIssue]
Loading