@@ -51,6 +51,7 @@ AR_m: npt.NDArray[np.timedelta64]
5151AR_M : npt .NDArray [np .datetime64 ]
5252AR_O : npt .NDArray [np .object_ ]
5353AR_number : npt .NDArray [np .number [Any ]]
54+ AR_Any : npt .NDArray [Any ]
5455
5556AR_LIKE_b : list [bool ]
5657AR_LIKE_u : list [np .uint32 ]
@@ -61,34 +62,35 @@ AR_LIKE_m: list[np.timedelta64]
6162AR_LIKE_M : list [np .datetime64 ]
6263AR_LIKE_O : list [np .object_ ]
6364
65+
6466# Array subtraction
6567
6668assert_type (AR_number - AR_number , npt .NDArray [np .number [Any ]])
6769
68- assert_type (AR_b - AR_LIKE_u , npt .NDArray [np .unsignedinteger [ Any ] ])
70+ assert_type (AR_b - AR_LIKE_u , npt .NDArray [np .uint32 ])
6971assert_type (AR_b - AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
7072assert_type (AR_b - AR_LIKE_f , npt .NDArray [np .floating [Any ]])
7173assert_type (AR_b - AR_LIKE_c , npt .NDArray [np .complexfloating [Any , Any ]])
7274assert_type (AR_b - AR_LIKE_m , npt .NDArray [np .timedelta64 ])
7375assert_type (AR_b - AR_LIKE_O , Any )
7476
75- assert_type (AR_LIKE_u - AR_b , npt .NDArray [np .unsignedinteger [ Any ] ])
77+ assert_type (AR_LIKE_u - AR_b , npt .NDArray [np .uint32 ])
7678assert_type (AR_LIKE_i - AR_b , npt .NDArray [np .signedinteger [Any ]])
7779assert_type (AR_LIKE_f - AR_b , npt .NDArray [np .floating [Any ]])
7880assert_type (AR_LIKE_c - AR_b , npt .NDArray [np .complexfloating [Any , Any ]])
7981assert_type (AR_LIKE_m - AR_b , npt .NDArray [np .timedelta64 ])
8082assert_type (AR_LIKE_M - AR_b , npt .NDArray [np .datetime64 ])
8183assert_type (AR_LIKE_O - AR_b , Any )
8284
83- assert_type (AR_u - AR_LIKE_b , npt .NDArray [np .unsignedinteger [ Any ] ])
85+ assert_type (AR_u - AR_LIKE_b , npt .NDArray [np .uint32 ])
8486assert_type (AR_u - AR_LIKE_u , npt .NDArray [np .unsignedinteger [Any ]])
8587assert_type (AR_u - AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
8688assert_type (AR_u - AR_LIKE_f , npt .NDArray [np .floating [Any ]])
8789assert_type (AR_u - AR_LIKE_c , npt .NDArray [np .complexfloating [Any , Any ]])
8890assert_type (AR_u - AR_LIKE_m , npt .NDArray [np .timedelta64 ])
8991assert_type (AR_u - AR_LIKE_O , Any )
9092
91- assert_type (AR_LIKE_b - AR_u , npt .NDArray [np .unsignedinteger [ Any ] ])
93+ assert_type (AR_LIKE_b - AR_u , npt .NDArray [np .uint32 ])
9294assert_type (AR_LIKE_u - AR_u , npt .NDArray [np .unsignedinteger [Any ]])
9395assert_type (AR_LIKE_i - AR_u , npt .NDArray [np .signedinteger [Any ]])
9496assert_type (AR_LIKE_f - AR_u , npt .NDArray [np .floating [Any ]])
@@ -97,15 +99,15 @@ assert_type(AR_LIKE_m - AR_u, npt.NDArray[np.timedelta64])
9799assert_type (AR_LIKE_M - AR_u , npt .NDArray [np .datetime64 ])
98100assert_type (AR_LIKE_O - AR_u , Any )
99101
100- assert_type (AR_i - AR_LIKE_b , npt .NDArray [np .signedinteger [ Any ] ])
102+ assert_type (AR_i - AR_LIKE_b , npt .NDArray [np .int64 ])
101103assert_type (AR_i - AR_LIKE_u , npt .NDArray [np .signedinteger [Any ]])
102104assert_type (AR_i - AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
103105assert_type (AR_i - AR_LIKE_f , npt .NDArray [np .floating [Any ]])
104106assert_type (AR_i - AR_LIKE_c , npt .NDArray [np .complexfloating [Any , Any ]])
105107assert_type (AR_i - AR_LIKE_m , npt .NDArray [np .timedelta64 ])
106108assert_type (AR_i - AR_LIKE_O , Any )
107109
108- assert_type (AR_LIKE_b - AR_i , npt .NDArray [np .signedinteger [ Any ] ])
110+ assert_type (AR_LIKE_b - AR_i , npt .NDArray [np .int64 ])
109111assert_type (AR_LIKE_u - AR_i , npt .NDArray [np .signedinteger [Any ]])
110112assert_type (AR_LIKE_i - AR_i , npt .NDArray [np .signedinteger [Any ]])
111113assert_type (AR_LIKE_f - AR_i , npt .NDArray [np .floating [Any ]])
@@ -114,32 +116,32 @@ assert_type(AR_LIKE_m - AR_i, npt.NDArray[np.timedelta64])
114116assert_type (AR_LIKE_M - AR_i , npt .NDArray [np .datetime64 ])
115117assert_type (AR_LIKE_O - AR_i , Any )
116118
117- assert_type (AR_f - AR_LIKE_b , npt .NDArray [np .floating [ Any ] ])
118- assert_type (AR_f - AR_LIKE_u , npt .NDArray [np .floating [ Any ] ])
119- assert_type (AR_f - AR_LIKE_i , npt .NDArray [np .floating [ Any ] ])
120- assert_type (AR_f - AR_LIKE_f , npt .NDArray [np .floating [ Any ] ])
119+ assert_type (AR_f - AR_LIKE_b , npt .NDArray [np .float64 ])
120+ assert_type (AR_f - AR_LIKE_u , npt .NDArray [np .float64 ])
121+ assert_type (AR_f - AR_LIKE_i , npt .NDArray [np .float64 ])
122+ assert_type (AR_f - AR_LIKE_f , npt .NDArray [np .float64 ])
121123assert_type (AR_f - AR_LIKE_c , npt .NDArray [np .complexfloating [Any , Any ]])
122124assert_type (AR_f - AR_LIKE_O , Any )
123125
124- assert_type (AR_LIKE_b - AR_f , npt .NDArray [np .floating [ Any ] ])
125- assert_type (AR_LIKE_u - AR_f , npt .NDArray [np .floating [ Any ] ])
126- assert_type (AR_LIKE_i - AR_f , npt .NDArray [np .floating [ Any ] ])
127- assert_type (AR_LIKE_f - AR_f , npt .NDArray [np .floating [ Any ] ])
126+ assert_type (AR_LIKE_b - AR_f , npt .NDArray [np .float64 ])
127+ assert_type (AR_LIKE_u - AR_f , npt .NDArray [np .float64 ])
128+ assert_type (AR_LIKE_i - AR_f , npt .NDArray [np .float64 ])
129+ assert_type (AR_LIKE_f - AR_f , npt .NDArray [np .float64 ])
128130assert_type (AR_LIKE_c - AR_f , npt .NDArray [np .complexfloating [Any , Any ]])
129131assert_type (AR_LIKE_O - AR_f , Any )
130132
131- assert_type (AR_c - AR_LIKE_b , npt .NDArray [np .complexfloating [ Any , Any ] ])
132- assert_type (AR_c - AR_LIKE_u , npt .NDArray [np .complexfloating [ Any , Any ] ])
133- assert_type (AR_c - AR_LIKE_i , npt .NDArray [np .complexfloating [ Any , Any ] ])
134- assert_type (AR_c - AR_LIKE_f , npt .NDArray [np .complexfloating [ Any , Any ] ])
135- assert_type (AR_c - AR_LIKE_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
133+ assert_type (AR_c - AR_LIKE_b , npt .NDArray [np .complex128 ])
134+ assert_type (AR_c - AR_LIKE_u , npt .NDArray [np .complex128 ])
135+ assert_type (AR_c - AR_LIKE_i , npt .NDArray [np .complex128 ])
136+ assert_type (AR_c - AR_LIKE_f , npt .NDArray [np .complex128 ])
137+ assert_type (AR_c - AR_LIKE_c , npt .NDArray [np .complex128 ])
136138assert_type (AR_c - AR_LIKE_O , Any )
137139
138- assert_type (AR_LIKE_b - AR_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
139- assert_type (AR_LIKE_u - AR_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
140- assert_type (AR_LIKE_i - AR_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
141- assert_type (AR_LIKE_f - AR_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
142- assert_type (AR_LIKE_c - AR_c , npt .NDArray [np .complexfloating [ Any , Any ] ])
140+ assert_type (AR_LIKE_b - AR_c , npt .NDArray [np .complex128 ])
141+ assert_type (AR_LIKE_u - AR_c , npt .NDArray [np .complex128 ])
142+ assert_type (AR_LIKE_i - AR_c , npt .NDArray [np .complex128 ])
143+ assert_type (AR_LIKE_f - AR_c , npt .NDArray [np .complex128 ])
144+ assert_type (AR_LIKE_c - AR_c , npt .NDArray [np .complex128 ])
143145assert_type (AR_LIKE_O - AR_c , Any )
144146
145147assert_type (AR_m - AR_LIKE_b , npt .NDArray [np .timedelta64 ])
@@ -186,53 +188,53 @@ assert_type(AR_LIKE_O - AR_O, Any)
186188# Array floor division
187189
188190assert_type (AR_b // AR_LIKE_b , npt .NDArray [np .int8 ])
189- assert_type (AR_b // AR_LIKE_u , npt .NDArray [np .unsignedinteger [ Any ] ])
191+ assert_type (AR_b // AR_LIKE_u , npt .NDArray [np .uint32 ])
190192assert_type (AR_b // AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
191193assert_type (AR_b // AR_LIKE_f , npt .NDArray [np .floating [Any ]])
192194assert_type (AR_b // AR_LIKE_O , Any )
193195
194196assert_type (AR_LIKE_b // AR_b , npt .NDArray [np .int8 ])
195- assert_type (AR_LIKE_u // AR_b , npt .NDArray [np .unsignedinteger [ Any ] ])
197+ assert_type (AR_LIKE_u // AR_b , npt .NDArray [np .uint32 ])
196198assert_type (AR_LIKE_i // AR_b , npt .NDArray [np .signedinteger [Any ]])
197199assert_type (AR_LIKE_f // AR_b , npt .NDArray [np .floating [Any ]])
198200assert_type (AR_LIKE_O // AR_b , Any )
199201
200- assert_type (AR_u // AR_LIKE_b , npt .NDArray [np .unsignedinteger [ Any ] ])
202+ assert_type (AR_u // AR_LIKE_b , npt .NDArray [np .uint32 ])
201203assert_type (AR_u // AR_LIKE_u , npt .NDArray [np .unsignedinteger [Any ]])
202204assert_type (AR_u // AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
203205assert_type (AR_u // AR_LIKE_f , npt .NDArray [np .floating [Any ]])
204206assert_type (AR_u // AR_LIKE_O , Any )
205207
206- assert_type (AR_LIKE_b // AR_u , npt .NDArray [np .unsignedinteger [ Any ] ])
208+ assert_type (AR_LIKE_b // AR_u , npt .NDArray [np .uint32 ])
207209assert_type (AR_LIKE_u // AR_u , npt .NDArray [np .unsignedinteger [Any ]])
208210assert_type (AR_LIKE_i // AR_u , npt .NDArray [np .signedinteger [Any ]])
209211assert_type (AR_LIKE_f // AR_u , npt .NDArray [np .floating [Any ]])
210212assert_type (AR_LIKE_m // AR_u , npt .NDArray [np .timedelta64 ])
211213assert_type (AR_LIKE_O // AR_u , Any )
212214
213- assert_type (AR_i // AR_LIKE_b , npt .NDArray [np .signedinteger [ Any ] ])
215+ assert_type (AR_i // AR_LIKE_b , npt .NDArray [np .int64 ])
214216assert_type (AR_i // AR_LIKE_u , npt .NDArray [np .signedinteger [Any ]])
215217assert_type (AR_i // AR_LIKE_i , npt .NDArray [np .signedinteger [Any ]])
216218assert_type (AR_i // AR_LIKE_f , npt .NDArray [np .floating [Any ]])
217219assert_type (AR_i // AR_LIKE_O , Any )
218220
219- assert_type (AR_LIKE_b // AR_i , npt .NDArray [np .signedinteger [ Any ] ])
221+ assert_type (AR_LIKE_b // AR_i , npt .NDArray [np .int64 ])
220222assert_type (AR_LIKE_u // AR_i , npt .NDArray [np .signedinteger [Any ]])
221223assert_type (AR_LIKE_i // AR_i , npt .NDArray [np .signedinteger [Any ]])
222224assert_type (AR_LIKE_f // AR_i , npt .NDArray [np .floating [Any ]])
223225assert_type (AR_LIKE_m // AR_i , npt .NDArray [np .timedelta64 ])
224226assert_type (AR_LIKE_O // AR_i , Any )
225227
226- assert_type (AR_f // AR_LIKE_b , npt .NDArray [np .floating [ Any ] ])
227- assert_type (AR_f // AR_LIKE_u , npt .NDArray [np .floating [ Any ] ])
228- assert_type (AR_f // AR_LIKE_i , npt .NDArray [np .floating [ Any ] ])
229- assert_type (AR_f // AR_LIKE_f , npt .NDArray [np .floating [ Any ] ])
228+ assert_type (AR_f // AR_LIKE_b , npt .NDArray [np .float64 ])
229+ assert_type (AR_f // AR_LIKE_u , npt .NDArray [np .float64 ])
230+ assert_type (AR_f // AR_LIKE_i , npt .NDArray [np .float64 ])
231+ assert_type (AR_f // AR_LIKE_f , npt .NDArray [np .float64 ])
230232assert_type (AR_f // AR_LIKE_O , Any )
231233
232- assert_type (AR_LIKE_b // AR_f , npt .NDArray [np .floating [ Any ] ])
233- assert_type (AR_LIKE_u // AR_f , npt .NDArray [np .floating [ Any ] ])
234- assert_type (AR_LIKE_i // AR_f , npt .NDArray [np .floating [ Any ] ])
235- assert_type (AR_LIKE_f // AR_f , npt .NDArray [np .floating [ Any ] ])
234+ assert_type (AR_LIKE_b // AR_f , npt .NDArray [np .float64 ])
235+ assert_type (AR_LIKE_u // AR_f , npt .NDArray [np .float64 ])
236+ assert_type (AR_LIKE_i // AR_f , npt .NDArray [np .float64 ])
237+ assert_type (AR_LIKE_f // AR_f , npt .NDArray [np .float64 ])
236238assert_type (AR_LIKE_m // AR_f , npt .NDArray [np .timedelta64 ])
237239assert_type (AR_LIKE_O // AR_f , Any )
238240
@@ -407,7 +409,7 @@ assert_type(c16 + b_, np.complex128)
407409assert_type (c16 + b , np .complex128 )
408410assert_type (c16 + c , np .complex128 )
409411assert_type (c16 + f , np .complex128 )
410- assert_type (c16 + AR_f , npt .NDArray [np .complexfloating [ Any , Any ] ])
412+ assert_type (c16 + AR_f , npt .NDArray [np .complex128 ])
411413
412414assert_type (f16 + c16 , np .complex128 | np .complexfloating [_128Bit , _128Bit ])
413415assert_type (c16 + c16 , np .complex128 )
@@ -420,7 +422,7 @@ assert_type(b_ + c16, np.complex128)
420422assert_type (b + c16 , np .complex128 )
421423assert_type (c + c16 , np .complex128 )
422424assert_type (f + c16 , np .complex128 )
423- assert_type (AR_f + c16 , npt .NDArray [np .complexfloating [ Any , Any ] ])
425+ assert_type (AR_f + c16 , npt .NDArray [np .complex128 ])
424426
425427assert_type (c8 + f16 , np .complexfloating [_32Bit , _32Bit ] | np .complexfloating [_128Bit , _128Bit ])
426428assert_type (c8 + c16 , np .complex64 | np .complex128 )
@@ -433,7 +435,7 @@ assert_type(c8 + b_, np.complex64)
433435assert_type (c8 + b , np .complex64 )
434436assert_type (c8 + c , np .complex64 | np .complex128 )
435437assert_type (c8 + f , np .complex64 | np .complex128 )
436- assert_type (c8 + AR_f , npt .NDArray [np .complexfloating [ Any , Any ] ])
438+ assert_type (c8 + AR_f , npt .NDArray [np .complexfloating ])
437439
438440assert_type (f16 + c8 , np .complexfloating [_128Bit , _128Bit ] | np .complex64 )
439441assert_type (c16 + c8 , np .complex128 )
@@ -446,7 +448,7 @@ assert_type(b_ + c8, np.complex64)
446448assert_type (b + c8 , np .complex64 )
447449assert_type (c + c8 , np .complex64 | np .complex128 )
448450assert_type (f + c8 , np .complex64 | np .complex128 )
449- assert_type (AR_f + c8 , npt .NDArray [np .complexfloating [ Any , Any ] ])
451+ assert_type (AR_f + c8 , npt .NDArray [np .complexfloating ])
450452
451453# Float
452454
@@ -459,18 +461,18 @@ assert_type(f8 + b_, np.float64)
459461assert_type (f8 + b , np .float64 )
460462assert_type (f8 + c , np .float64 | np .complex128 )
461463assert_type (f8 + f , np .float64 )
462- assert_type (f8 + AR_f , npt .NDArray [np .floating [ Any ] ])
464+ assert_type (f8 + AR_f , npt .NDArray [np .float64 ])
463465
464466assert_type (f16 + f8 , np .floating [_128Bit ] | np .float64 )
465467assert_type (f8 + f8 , np .float64 )
466468assert_type (i8 + f8 , np .float64 )
467- assert_type (f4 + f8 , np .floating [ _32Bit ] | np .float64 )
469+ assert_type (f4 + f8 , np .float32 | np .float64 )
468470assert_type (i4 + f8 ,np .float64 )
469471assert_type (b_ + f8 , np .float64 )
470472assert_type (b + f8 , np .float64 )
471473assert_type (c + f8 , np .complex128 | np .float64 )
472474assert_type (f + f8 , np .float64 )
473- assert_type (AR_f + f8 , npt .NDArray [np .floating [ Any ] ])
475+ assert_type (AR_f + f8 , npt .NDArray [np .float64 ])
474476
475477assert_type (f4 + f16 , np .float32 | np .floating [_128Bit ])
476478assert_type (f4 + f8 , np .float32 | np .float64 )
@@ -481,7 +483,7 @@ assert_type(f4 + b_, np.float32)
481483assert_type (f4 + b , np .float32 )
482484assert_type (f4 + c , np .complex64 | np .complex128 )
483485assert_type (f4 + f , np .float32 | np .float64 )
484- assert_type (f4 + AR_f , npt .NDArray [np .floating [ Any ] ])
486+ assert_type (f4 + AR_f , npt .NDArray [np .float64 ])
485487
486488assert_type (f16 + f4 , np .floating [_128Bit ] | np .float32 )
487489assert_type (f8 + f4 , np .float64 )
@@ -492,7 +494,7 @@ assert_type(b_ + f4, np.float32)
492494assert_type (b + f4 , np .float32 )
493495assert_type (c + f4 , np .complex64 | np .complex128 )
494496assert_type (f + f4 , np .float64 | np .float32 )
495- assert_type (AR_f + f4 , npt .NDArray [np .floating [ Any ] ])
497+ assert_type (AR_f + f4 , npt .NDArray [np .float64 ])
496498
497499# Int
498500
@@ -504,7 +506,7 @@ assert_type(i8 + b_, np.int64)
504506assert_type (i8 + b , np .int64 )
505507assert_type (i8 + c , np .complex128 )
506508assert_type (i8 + f , np .float64 )
507- assert_type (i8 + AR_f , npt .NDArray [np .floating [ Any ] ])
509+ assert_type (i8 + AR_f , npt .NDArray [np .float64 ])
508510
509511assert_type (u8 + u8 , np .uint64 )
510512assert_type (u8 + i4 , Any )
@@ -513,7 +515,7 @@ assert_type(u8 + b_, np.uint64)
513515assert_type (u8 + b , np .uint64 )
514516assert_type (u8 + c , np .complex128 )
515517assert_type (u8 + f , np .float64 )
516- assert_type (u8 + AR_f , npt .NDArray [np .floating [ Any ] ])
518+ assert_type (u8 + AR_f , npt .NDArray [np .float64 ])
517519
518520assert_type (i8 + i8 , np .int64 )
519521assert_type (u8 + i8 , Any )
@@ -523,7 +525,7 @@ assert_type(b_ + i8, np.int64)
523525assert_type (b + i8 , np .int64 )
524526assert_type (c + i8 , np .complex128 )
525527assert_type (f + i8 , np .float64 )
526- assert_type (AR_f + i8 , npt .NDArray [np .floating [ Any ] ])
528+ assert_type (AR_f + i8 , npt .NDArray [np .float64 ])
527529
528530assert_type (u8 + u8 , np .uint64 )
529531assert_type (i4 + u8 , Any )
@@ -532,32 +534,36 @@ assert_type(b_ + u8, np.uint64)
532534assert_type (b + u8 , np .uint64 )
533535assert_type (c + u8 , np .complex128 )
534536assert_type (f + u8 , np .float64 )
535- assert_type (AR_f + u8 , npt .NDArray [np .floating [ Any ] ])
537+ assert_type (AR_f + u8 , npt .NDArray [np .float64 ])
536538
537539assert_type (i4 + i8 , np .signedinteger [_32Bit ] | np .signedinteger [_64Bit ])
538540assert_type (i4 + i4 , np .int32 )
539541assert_type (i4 + b_ , np .int32 )
540542assert_type (i4 + b , np .int32 )
541- assert_type (i4 + AR_f , npt .NDArray [np .floating [ Any ] ])
543+ assert_type (i4 + AR_f , npt .NDArray [np .float64 ])
542544
543545assert_type (u4 + i8 , Any )
544546assert_type (u4 + i4 , Any )
545547assert_type (u4 + u8 , np .unsignedinteger [_32Bit ] | np .unsignedinteger [_64Bit ])
546548assert_type (u4 + u4 , np .uint32 )
547549assert_type (u4 + b_ , np .uint32 )
548550assert_type (u4 + b , np .uint32 )
549- assert_type (u4 + AR_f , npt .NDArray [np .floating [ Any ] ])
551+ assert_type (u4 + AR_f , npt .NDArray [np .float64 ])
550552
551553assert_type (i8 + i4 , np .signedinteger [_32Bit ] | np .signedinteger [_64Bit ])
552554assert_type (i4 + i4 , np .int32 )
553555assert_type (b_ + i4 , np .int32 )
554556assert_type (b + i4 , np .int32 )
555- assert_type (AR_f + i4 , npt .NDArray [np .floating [ Any ] ])
557+ assert_type (AR_f + i4 , npt .NDArray [np .float64 ])
556558
557559assert_type (i8 + u4 , Any )
558560assert_type (i4 + u4 , Any )
559561assert_type (u8 + u4 , np .unsignedinteger [_32Bit ] | np .unsignedinteger [_64Bit ])
560562assert_type (u4 + u4 , np .uint32 )
561563assert_type (b_ + u4 , np .uint32 )
562564assert_type (b + u4 , np .uint32 )
563- assert_type (AR_f + u4 , npt .NDArray [np .floating [Any ]])
565+ assert_type (AR_f + u4 , npt .NDArray [np .float64 ])
566+
567+ # Any
568+
569+ assert_type (AR_Any + 2 , npt .NDArray [Any ])
0 commit comments