1
1
import sys
2
- from typing import Any , Literal as L , TypeVar
2
+ from typing import Any , TypeVar
3
3
from pathlib import Path
4
4
from collections import deque
5
5
@@ -19,6 +19,8 @@ B: SubClass[np.float64]
19
19
C : list [int ]
20
20
D : SubClass [np .float64 | np .int64 ]
21
21
22
+ mixed_shape : tuple [int , np .int64 ]
23
+
22
24
def func (i : int , j : int , ** kwargs : Any ) -> SubClass [np .float64 ]: ...
23
25
24
26
assert_type (np .empty_like (A ), npt .NDArray [np .float64 ])
@@ -43,10 +45,12 @@ assert_type(np.array(D), npt.NDArray[np.float64 | np.int64])
43
45
assert_type (np .zeros ([1 , 5 , 6 ]), npt .NDArray [np .float64 ])
44
46
assert_type (np .zeros ([1 , 5 , 6 ], dtype = np .int64 ), npt .NDArray [np .int64 ])
45
47
assert_type (np .zeros ([1 , 5 , 6 ], dtype = 'c16' ), npt .NDArray [Any ])
48
+ assert_type (np .zeros (mixed_shape ), npt .NDArray [np .float64 ])
46
49
47
50
assert_type (np .empty ([1 , 5 , 6 ]), npt .NDArray [np .float64 ])
48
51
assert_type (np .empty ([1 , 5 , 6 ], dtype = np .int64 ), npt .NDArray [np .int64 ])
49
52
assert_type (np .empty ([1 , 5 , 6 ], dtype = 'c16' ), npt .NDArray [Any ])
53
+ assert_type (np .empty (mixed_shape ), npt .NDArray [np .float64 ])
50
54
51
55
assert_type (np .concatenate (A ), npt .NDArray [np .float64 ])
52
56
assert_type (np .concatenate ([A , A ]), npt .NDArray [Any ])
@@ -182,6 +186,7 @@ assert_type(np.ones(_shape_1d, dtype=np.int64), np.ndarray[tuple[int], np.dtype[
182
186
assert_type (np .ones (_shape_like ), npt .NDArray [np .float64 ])
183
187
assert_type (np .ones (_shape_like , dtype = np .dtypes .Int64DType ()), np .ndarray [Any , np .dtypes .Int64DType ])
184
188
assert_type (np .ones (_shape_like , dtype = int ), npt .NDArray [Any ])
189
+ assert_type (np .ones (mixed_shape ), npt .NDArray [np .float64 ])
185
190
186
191
assert_type (np .full (_size , i8 ), np .ndarray [tuple [int ], np .dtype [np .int64 ]])
187
192
assert_type (np .full (_shape_2d , i8 ), np .ndarray [tuple [int , int ], np .dtype [np .int64 ]])
0 commit comments