11import sys
2- from typing import Any , Literal as L , TypeVar
2+ from typing import Any , TypeVar
33from pathlib import Path
44from collections import deque
55
@@ -19,6 +19,8 @@ B: SubClass[np.float64]
1919C : list [int ]
2020D : SubClass [np .float64 | np .int64 ]
2121
22+ mixed_shape : tuple [int , np .int64 ]
23+
2224def func (i : int , j : int , ** kwargs : Any ) -> SubClass [np .float64 ]: ...
2325
2426assert_type (np .empty_like (A ), npt .NDArray [np .float64 ])
@@ -43,10 +45,12 @@ assert_type(np.array(D), npt.NDArray[np.float64 | np.int64])
4345assert_type (np .zeros ([1 , 5 , 6 ]), npt .NDArray [np .float64 ])
4446assert_type (np .zeros ([1 , 5 , 6 ], dtype = np .int64 ), npt .NDArray [np .int64 ])
4547assert_type (np .zeros ([1 , 5 , 6 ], dtype = 'c16' ), npt .NDArray [Any ])
48+ assert_type (np .zeros (mixed_shape ), npt .NDArray [np .float64 ])
4649
4750assert_type (np .empty ([1 , 5 , 6 ]), npt .NDArray [np .float64 ])
4851assert_type (np .empty ([1 , 5 , 6 ], dtype = np .int64 ), npt .NDArray [np .int64 ])
4952assert_type (np .empty ([1 , 5 , 6 ], dtype = 'c16' ), npt .NDArray [Any ])
53+ assert_type (np .empty (mixed_shape ), npt .NDArray [np .float64 ])
5054
5155assert_type (np .concatenate (A ), npt .NDArray [np .float64 ])
5256assert_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[
182186assert_type (np .ones (_shape_like ), npt .NDArray [np .float64 ])
183187assert_type (np .ones (_shape_like , dtype = np .dtypes .Int64DType ()), np .ndarray [Any , np .dtypes .Int64DType ])
184188assert_type (np .ones (_shape_like , dtype = int ), npt .NDArray [Any ])
189+ assert_type (np .ones (mixed_shape ), npt .NDArray [np .float64 ])
185190
186191assert_type (np .full (_size , i8 ), np .ndarray [tuple [int ], np .dtype [np .int64 ]])
187192assert_type (np .full (_shape_2d , i8 ), np .ndarray [tuple [int , int ], np .dtype [np .int64 ]])
0 commit comments