Skip to content

Commit 59f1aa4

Browse files
JulVandenBroeckjulvdb
authored andcommitted
Re-added problematic tests with notes
1 parent 43bf8f5 commit 59f1aa4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/sparse/test_construct.pyi

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,21 @@ assert_type(sparse.block_array([[coo_arr]], dtype=int), sparse.coo_array[np.int_
269269
assert_type(sparse.block_array([[csr_arr]], dtype=sctype), sparse.csr_array[ScalarType, tuple[int, int]])
270270
assert_type(sparse.block_array([[lil_arr]], dtype=np.complex64), sparse.coo_array[np.complex64, tuple[int, int]])
271271
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+
274277
# bmat (legacy, `block_array` is p`referred)
275278
assert_type(sparse.bmat([[bsr_mat]]), sparse.coo_matrix[ScalarType])
276-
assert_type(sparse.bmat([[csr_mat]]), sparse.csr_matrix[ScalarType])
277279
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])
279280
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]])
281281
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]
283287

284288
# block_diag
285289
assert_type(sparse.block_diag([any_arr, any_arr]), sparse.coo_array[ScalarType, tuple[int, int]])

0 commit comments

Comments
 (0)