Skip to content

Commit 39b3f3f

Browse files
committed
TST: Update the np.core.numerictypes typing tests
1 parent bad58f9 commit 39b3f3f

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

numpy/typing/tests/data/fail/numerictypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#
55
# https://github.com/numpy/numpy/issues/16366
66
#
7-
np.maximum_sctype(1) # E: incompatible type "int"
7+
np.maximum_sctype(1) # E: No overload variant
88

9-
np.issubsctype(1, np.int64) # E: incompatible type "int"
9+
np.issubsctype(1, np.int64) # E: incompatible type
1010

11-
np.issubdtype(1, np.int64) # E: incompatible type "int"
11+
np.issubdtype(1, np.int64) # E: incompatible type
1212

13-
np.find_common_type(np.int64, np.int64) # E: incompatible type "Type[signedinteger[Any]]"
13+
np.find_common_type(np.int64, np.int64) # E: incompatible type

numpy/typing/tests/data/reveal/numerictypes.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
import numpy as np
22

3-
reveal_type(np.issctype(np.generic)) # E: bool
4-
reveal_type(np.issctype("foo")) # E: bool
3+
reveal_type(np.maximum_sctype(np.float64)) # E: Type[{float64}]
4+
reveal_type(np.maximum_sctype("f8")) # E: Type[Any]
55

6-
reveal_type(np.obj2sctype("S8")) # E: Union[numpy.generic, None]
7-
reveal_type(np.obj2sctype("S8", default=None)) # E: Union[numpy.generic, None]
8-
reveal_type(
9-
np.obj2sctype("foo", default=int) # E: Union[numpy.generic, Type[builtins.int*]]
10-
)
6+
reveal_type(np.issctype(np.float64)) # E: bool
7+
reveal_type(np.issctype("foo")) # E: Literal[False]
8+
9+
reveal_type(np.obj2sctype(np.float64)) # E: Union[None, Type[{float64}]]
10+
reveal_type(np.obj2sctype(np.float64, default=False)) # E: Union[builtins.bool, Type[{float64}]]
11+
reveal_type(np.obj2sctype("S8")) # E: Union[None, Type[Any]]
12+
reveal_type(np.obj2sctype("S8", default=None)) # E: Union[None, Type[Any]]
13+
reveal_type(np.obj2sctype("foo", default=False)) # E: Union[builtins.bool, Type[Any]]
14+
reveal_type(np.obj2sctype(1)) # E: None
15+
reveal_type(np.obj2sctype(1, default=False)) # E: bool
1116

1217
reveal_type(np.issubclass_(np.float64, float)) # E: bool
1318
reveal_type(np.issubclass_(np.float64, (int, float))) # E: bool
19+
reveal_type(np.issubclass_(1, 1)) # E: Literal[False]
1420

1521
reveal_type(np.sctype2char("S8")) # E: str
1622
reveal_type(np.sctype2char(list)) # E: str
1723

18-
reveal_type(np.find_common_type([np.int64], [np.int64])) # E: numpy.dtype
24+
reveal_type(np.find_common_type([np.int64], [np.int64])) # E: numpy.dtype[Any]
1925

2026
reveal_type(np.cast[int]) # E: _CastFunc
2127
reveal_type(np.cast["i8"]) # E: _CastFunc

0 commit comments

Comments
 (0)