Skip to content

Commit 82aa178

Browse files
authored
Merge pull request #281 from numpy/ma.testutils
🏷️ stub `numpy.ma.testutils`
2 parents f537627 + 3f7b3f5 commit 82aa178

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

src/numpy-stubs/ma/testutils.pyi

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from unittest import TestCase as _TestCase
2+
3+
import numpy as np
4+
import numpy.typing as npt
5+
from numpy.testing import assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises
6+
from numpy.testing._private.utils import _ComparisonFunc
7+
8+
__all__ = [
9+
"TestCase",
10+
"almost",
11+
"approx",
12+
"assert_",
13+
"assert_allclose",
14+
"assert_almost_equal",
15+
"assert_array_almost_equal",
16+
"assert_array_almost_equal_nulp",
17+
"assert_array_approx_equal",
18+
"assert_array_compare",
19+
"assert_array_equal",
20+
"assert_array_less",
21+
"assert_close",
22+
"assert_equal",
23+
"assert_equal_records",
24+
"assert_mask_equal",
25+
"assert_not_equal",
26+
"assert_raises",
27+
"fail_if_array_equal",
28+
]
29+
30+
def approx(
31+
a: object,
32+
b: object,
33+
fill_value: bool = True,
34+
rtol: float = 1e-5,
35+
atol: float = 1e-8,
36+
) -> np.ndarray[tuple[int], np.dtype[np.bool]]: ...
37+
def almost(
38+
a: object,
39+
b: object,
40+
decimal: int = 6,
41+
fill_value: bool = True,
42+
) -> np.ndarray[tuple[int], np.dtype[np.bool]]: ...
43+
44+
#
45+
def assert_equal_records(a: npt.NDArray[np.void], b: npt.NDArray[np.void]) -> None: ...
46+
def assert_equal(actual: object, desired: object, err_msg: str = "") -> None: ...
47+
def fail_if_equal(actual: object, desired: object, err_msg: str = "") -> None: ...
48+
def assert_almost_equal(actual: object, desired: object, decimal: int = 7, err_msg: str = "", verbose: bool = True) -> None: ...
49+
50+
#
51+
def assert_array_compare(
52+
comparison: _ComparisonFunc,
53+
x: object,
54+
y: object,
55+
err_msg: str = "",
56+
verbose: bool = True,
57+
header: str = "",
58+
fill_value: bool = True,
59+
) -> None: ...
60+
def assert_array_equal(x: object, y: object, err_msg: str = "", verbose: bool = True) -> None: ...
61+
def fail_if_array_equal(x: object, y: object, err_msg: str = "", verbose: bool = True) -> None: ...
62+
def assert_array_approx_equal(x: object, y: object, decimal: int = 6, err_msg: str = "", verbose: bool = True) -> None: ...
63+
def assert_array_almost_equal(x: object, y: object, decimal: int = 6, err_msg: str = "", verbose: bool = True) -> None: ...
64+
def assert_array_less(x: object, y: object, err_msg: str = "", verbose: bool = True) -> None: ...
65+
def assert_mask_equal(m1: object, m2: object, err_msg: str = "") -> None: ...
66+
67+
assert_not_equal = fail_if_equal
68+
assert_close = assert_almost_equal
69+
70+
class TestCase(_TestCase):
71+
def __init_subclass__(cls, *args: object, **kwargs: object) -> None: ...

tool/.mypyignore-todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ numpy.f2py.diagnose
2020
numpy.f2py.crackfortran
2121
numpy.f2py.symbolic
2222
numpy.f2py.((cb|common|f90mod|use)_)?rules
23-
24-
numpy.ma.testutils

0 commit comments

Comments
 (0)