Skip to content

Commit d6af1ad

Browse files
jorenhamguan404ming
andcommitted
🤡 also apply the unittest.TestCase workaround to numpy.testing.TestCase
Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>
1 parent 82aa178 commit d6af1ad

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

‎src/numpy-stubs/ma/testutils.pyi

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from unittest import TestCase as _TestCase
2-
31
import numpy as np
42
import numpy.typing as npt
5-
from numpy.testing import assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises
3+
from numpy.testing import TestCase, assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises
64
from numpy.testing._private.utils import _ComparisonFunc
75

86
__all__ = [
@@ -66,6 +64,3 @@ def assert_mask_equal(m1: object, m2: object, err_msg: str = "") -> None: ...
6664

6765
assert_not_equal = fail_if_equal
6866
assert_close = assert_almost_equal
69-
70-
class TestCase(_TestCase):
71-
def __init_subclass__(cls, *args: object, **kwargs: object) -> None: ...

‎src/numpy-stubs/testing/__init__.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from unittest import TestCase
1+
from unittest import TestCase as _TestCase
22

33
from . import overrides
44
from ._private.utils import (
@@ -100,3 +100,7 @@ __all__ = [
100100
"temppath",
101101
"verbose",
102102
]
103+
104+
# workaround for incorrect typeshed definition
105+
class TestCase(_TestCase):
106+
def __init_subclass__(cls, *args: object, **kwargs: object) -> None: ...

‎tool/.mypyignore.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ numpy\.testing(\._private\.utils)?\.check_support_sve
3232

3333
# stdlib re-exports with incorrect typeshed stubs
3434
numpy\.compat(\.py3k)?\.os_PathLike\.__class_getitem__
35-
numpy\.testing\.TestCase\.__init_subclass__

0 commit comments

Comments
 (0)