Skip to content

Commit 53b84fd

Browse files
committed
TST: Expand the __class_getitem__ test coverage for python 3.8
1 parent f840f23 commit 53b84fd

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

numpy/core/tests/test_arraymethod.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ def test_subscript_tuple(self, arg_len: int) -> None:
8585
def test_subscript_scalar(self) -> None:
8686
with pytest.raises(TypeError):
8787
np.ndarray[Any]
88+
89+
90+
@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
91+
def test_class_getitem_38() -> None:
92+
match = "Type subscription requires python >= 3.9"
93+
with pytest.raises(TypeError, match=match):
94+
np.ndarray[Any, Any]

numpy/core/tests/test_dtype.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,3 +1578,10 @@ def test_subscript_tuple(self, arg_len: int) -> None:
15781578

15791579
def test_subscript_scalar(self) -> None:
15801580
assert np.dtype[Any]
1581+
1582+
1583+
@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
1584+
def test_class_getitem_38() -> None:
1585+
match = "Type subscription requires python >= 3.9"
1586+
with pytest.raises(TypeError, match=match):
1587+
np.dtype[Any]

numpy/core/tests/test_scalar_methods.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,11 @@ def test_subscript_tuple(self, arg_len: int) -> None:
171171

172172
def test_subscript_scalar(self) -> None:
173173
assert np.number[Any]
174+
175+
176+
@pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8")
177+
@pytest.mark.parametrize("cls", [np.number, np.int64])
178+
def test_class_getitem_38(cls: Type[np.number]) -> None:
179+
match = "Type subscription requires python >= 3.9"
180+
with pytest.raises(TypeError, match=match):
181+
cls[Any]

0 commit comments

Comments
 (0)