Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion numpy/ma/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ class MaskedArray(ndarray[_ShapeT_co, _DTypeT_co]):

def ravel(self, order: _OrderKACF = "C") -> MaskedArray[tuple[int], _DTypeT_co]: ...
def reshape(self, *s, **kwargs): ...
def resize(self, newshape, refcheck=..., order=...): ...
def resize(self: Never, newshape: _ShapeLike, refcheck: bool = True, order: bool = False) -> NoReturn: ...
def put(self, indices: _ArrayLikeInt_co, values: ArrayLike, mode: _ModeKind = "raise") -> None: ...
def ids(self) -> tuple[int, int]: ...
def iscontiguous(self) -> bool: ...
Expand Down
5 changes: 4 additions & 1 deletion numpy/typing/tests/data/reveal/lib_polynomial.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ assert_type(np.polyadd(AR_O, AR_O), npt.NDArray[np.object_])

assert_type(np.polysub(poly_obj, AR_i8), np.poly1d)
assert_type(np.polysub(AR_f8, poly_obj), np.poly1d)
assert_type(np.polysub(AR_b, AR_b), NoReturn)

def test_invalid_polysub() -> None:
assert_type(np.polysub(AR_b, AR_b), NoReturn)

assert_type(np.polysub(AR_u4, AR_b), npt.NDArray[np.unsignedinteger])
assert_type(np.polysub(AR_i8, AR_i8), npt.NDArray[np.signedinteger])
assert_type(np.polysub(AR_f8, AR_i8), npt.NDArray[np.floating])
Expand Down
5 changes: 4 additions & 1 deletion numpy/typing/tests/data/reveal/ma.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Literal, TypeAlias, TypeVar, assert_type
from typing import Any, Literal, TypeAlias, TypeVar, assert_type, NoReturn

import numpy as np
from numpy import dtype, generic
Expand Down Expand Up @@ -405,6 +405,9 @@ assert_type(MAR_f8.cumprod(out=MAR_subclass), MaskedArraySubclass)
assert_type(MAR_f8.cumsum(), MaskedArray[Any])
assert_type(MAR_f8.cumsum(out=MAR_subclass), MaskedArraySubclass)

def invalid_resize() -> None:
assert_type(MAR_f8.resize((1,1)), NoReturn)

# Masked Array addition

assert_type(MAR_b + AR_LIKE_u, MaskedArray[np.uint32])
Expand Down
57 changes: 38 additions & 19 deletions numpy/typing/tests/data/reveal/ufuncs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,45 @@ assert_type(np.bitwise_count.identity, None)
assert_type(np.bitwise_count(i8), Any)
assert_type(np.bitwise_count(AR_i8), npt.NDArray[Any])

assert_type(np.absolute.outer(), NoReturn)
assert_type(np.frexp.outer(), NoReturn)
assert_type(np.divmod.outer(), NoReturn)
assert_type(np.matmul.outer(), NoReturn)
def test_absolute_outer_invalid() -> None:
assert_type(np.absolute.outer(), NoReturn)
def test_frexp_outer_invalid() -> None:
assert_type(np.frexp.outer(), NoReturn)
def test_divmod_outer_invalid() -> None:
assert_type(np.divmod.outer(), NoReturn)
def test_matmul_outer_invalid() -> None:
assert_type(np.matmul.outer(), NoReturn)

assert_type(np.absolute.reduceat(), NoReturn)
assert_type(np.frexp.reduceat(), NoReturn)
assert_type(np.divmod.reduceat(), NoReturn)
assert_type(np.matmul.reduceat(), NoReturn)
def test_absolute_reduceat_invalid() -> None:
assert_type(np.absolute.reduceat(), NoReturn)
def test_frexp_reduceat_invalid() -> None:
assert_type(np.frexp.reduceat(), NoReturn)
def test_divmod_reduceat_invalid() -> None:
assert_type(np.divmod.reduceat(), NoReturn)
def test_matmul_reduceat_invalid() -> None:
assert_type(np.matmul.reduceat(), NoReturn)

assert_type(np.absolute.reduce(), NoReturn)
assert_type(np.frexp.reduce(), NoReturn)
assert_type(np.divmod.reduce(), NoReturn)
assert_type(np.matmul.reduce(), NoReturn)
def test_absolute_reduce_invalid() -> None:
assert_type(np.absolute.reduce(), NoReturn)
def test_frexp_reduce_invalid() -> None:
assert_type(np.frexp.reduce(), NoReturn)
def test_divmod_reduce_invalid() -> None:
assert_type(np.divmod.reduce(), NoReturn)
def test_matmul_reduce_invalid() -> None:
assert_type(np.matmul.reduce(), NoReturn)

assert_type(np.absolute.accumulate(), NoReturn)
assert_type(np.frexp.accumulate(), NoReturn)
assert_type(np.divmod.accumulate(), NoReturn)
assert_type(np.matmul.accumulate(), NoReturn)
def test_absolute_accumulate_invalid() -> None:
assert_type(np.absolute.accumulate(), NoReturn)
def test_frexp_accumulate_invalid() -> None:
assert_type(np.frexp.accumulate(), NoReturn)
def test_divmod_accumulate_invalid() -> None:
assert_type(np.divmod.accumulate(), NoReturn)
def test_matmul_accumulate_invalid() -> None:
assert_type(np.matmul.accumulate(), NoReturn)

assert_type(np.frexp.at(), NoReturn)
assert_type(np.divmod.at(), NoReturn)
assert_type(np.matmul.at(), NoReturn)
def test_frexp_at_invalid() -> None:
assert_type(np.frexp.at(), NoReturn)
def test_divmod_at_invalid() -> None:
assert_type(np.divmod.at(), NoReturn)
def test_matmul_at_invalid() -> None:
assert_type(np.matmul.at(), NoReturn)
Loading