@@ -269,17 +269,21 @@ assert_type(sparse.block_array([[coo_arr]], dtype=int), sparse.coo_array[np.int_
269
269
assert_type (sparse .block_array ([[csr_arr ]], dtype = sctype ), sparse .csr_array [ScalarType , tuple [int , int ]])
270
270
assert_type (sparse .block_array ([[lil_arr ]], dtype = np .complex64 ), sparse .coo_array [np .complex64 , tuple [int , int ]])
271
271
assert_type (sparse .block_array ([[csr_arr ]], format = "lil" ), sparse .lil_array [ScalarType ])
272
- assert_type (sparse .block_array ([[coo_arr ]], format = "bsr" , dtype = "float" ), sparse .bsr_array [np .float64 ])
273
- assert_type (sparse .block_array ([[dia_arr ]], format = "dok" , dtype = complex ), sparse .dok_array [np .complex128 ])
272
+ assert_type (sparse .block_array ([[coo_arr , None ]], format = "bsr" , dtype = "float" ), sparse .bsr_array [np .float64 ])
273
+ assert_type (sparse .block_array ([[dia_arr ], [None ]], format = "dok" , dtype = complex ), sparse .dok_array [np .complex128 ])
274
+ # NOTE: mypy reports false positive errors here, because of join vs. union approach
275
+ assert_type (sparse .block_array ([[csr_arr , None ], [None , dok_arr ]], format = "dia" ), sparse .dia_array [ScalarType ]) # type: ignore[assert-type]
276
+
274
277
# bmat (legacy, `block_array` is p`referred)
275
278
assert_type (sparse .bmat ([[bsr_mat ]]), sparse .coo_matrix [ScalarType ])
276
- assert_type (sparse .bmat ([[csr_mat ]]), sparse .csr_matrix [ScalarType ])
277
279
assert_type (sparse .bmat ([[dia_mat ]], dtype = np .int_ ), sparse .coo_matrix [np .int_ ])
278
- assert_type (sparse .bmat ([[dok_mat ]], dtype = np .complex64 ), sparse .coo_matrix [np .complex64 ])
279
280
assert_type (sparse .bmat ([[bsr_arr ]]), sparse .coo_array [ScalarType , tuple [int , int ]])
280
- assert_type (sparse .bmat ([[csr_arr ]]), sparse .csr_array [ScalarType , tuple [int , int ]])
281
281
assert_type (sparse .bmat ([[dia_arr ]], dtype = np .int_ ), sparse .coo_array [np .int_ , tuple [int , int ]])
282
- assert_type (sparse .bmat ([[dok_arr ]], dtype = np .complex64 ), sparse .coo_array [np .complex64 , tuple [int , int ]])
282
+ # NOTE: mypy reports false positive errors here, because of join vs. union approach
283
+ assert_type (sparse .bmat ([[csr_mat ], [None ]]), sparse .csr_matrix [ScalarType ]) # type: ignore[assert-type,arg-type]
284
+ assert_type (sparse .bmat ([[dok_mat ], [None ]], dtype = np .complex64 ), sparse .coo_matrix [np .complex64 ]) # type: ignore[assert-type,arg-type]
285
+ assert_type (sparse .bmat ([[csr_arr ], [None ]]), sparse .csr_array [ScalarType , tuple [int , int ]]) # type: ignore[assert-type,arg-type]
286
+ assert_type (sparse .bmat ([[dok_arr ], [None ]], dtype = np .complex64 ), sparse .coo_array [np .complex64 , tuple [int , int ]]) # type: ignore[assert-type,arg-type]
283
287
284
288
# block_diag
285
289
assert_type (sparse .block_diag ([any_arr , any_arr ]), sparse .coo_array [ScalarType , tuple [int , int ]])
0 commit comments