Skip to content

Commit

Permalink
🤡 also apply the unittest.TestCase workaround to `numpy.testing.Tes…
Browse files Browse the repository at this point in the history
…tCase`

Co-authored-by: Guan Ming(Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
  • Loading branch information
jorenham and guan404ming committed Mar 8, 2025
1 parent 82aa178 commit d6af1ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/numpy-stubs/ma/testutils.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from unittest import TestCase as _TestCase

import numpy as np
import numpy.typing as npt
from numpy.testing import assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises
from numpy.testing import TestCase, assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises
from numpy.testing._private.utils import _ComparisonFunc

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

assert_not_equal = fail_if_equal
assert_close = assert_almost_equal

class TestCase(_TestCase):
def __init_subclass__(cls, *args: object, **kwargs: object) -> None: ...
6 changes: 5 additions & 1 deletion src/numpy-stubs/testing/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest import TestCase
from unittest import TestCase as _TestCase

from . import overrides
from ._private.utils import (
Expand Down Expand Up @@ -100,3 +100,7 @@ __all__ = [
"temppath",
"verbose",
]

# workaround for incorrect typeshed definition
class TestCase(_TestCase):
def __init_subclass__(cls, *args: object, **kwargs: object) -> None: ...
1 change: 0 additions & 1 deletion tool/.mypyignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ numpy\.testing(\._private\.utils)?\.check_support_sve

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

0 comments on commit d6af1ad

Please sign in to comment.