summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/tests/test_arraymethod.py7
-rw-r--r--numpy/core/tests/test_dtype.py7
-rw-r--r--numpy/core/tests/test_scalar_methods.py8
3 files changed, 22 insertions, 0 deletions
diff --git a/numpy/core/tests/test_arraymethod.py b/numpy/core/tests/test_arraymethod.py
index 1e5db5915..49aa9f6df 100644
--- a/numpy/core/tests/test_arraymethod.py
+++ b/numpy/core/tests/test_arraymethod.py
@@ -85,3 +85,10 @@ class TestClassGetItem:
def test_subscript_scalar(self) -> None:
with pytest.raises(TypeError):
np.ndarray[Any]
+
+
+@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
+def test_class_getitem_38() -> None:
+ match = "Type subscription requires python >= 3.9"
+ with pytest.raises(TypeError, match=match):
+ np.ndarray[Any, Any]
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py
index b438c1e8c..db4f275b5 100644
--- a/numpy/core/tests/test_dtype.py
+++ b/numpy/core/tests/test_dtype.py
@@ -1578,3 +1578,10 @@ class TestClassGetItem:
def test_subscript_scalar(self) -> None:
assert np.dtype[Any]
+
+
+@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
+def test_class_getitem_38() -> None:
+ match = "Type subscription requires python >= 3.9"
+ with pytest.raises(TypeError, match=match):
+ np.dtype[Any]
diff --git a/numpy/core/tests/test_scalar_methods.py b/numpy/core/tests/test_scalar_methods.py
index ad22697b2..01fc66f84 100644
--- a/numpy/core/tests/test_scalar_methods.py
+++ b/numpy/core/tests/test_scalar_methods.py
@@ -171,3 +171,11 @@ class TestClassGetItem:
def test_subscript_scalar(self) -> None:
assert np.number[Any]
+
+
+@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
+@pytest.mark.parametrize("cls", [np.number, np.int64])
+def test_class_getitem_38(cls: Type[np.number]) -> None:
+ match = "Type subscription requires python >= 3.9"
+ with pytest.raises(TypeError, match=match):
+ cls[Any]