File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -385,14 +385,17 @@ def test_inverse_transform_sparse_svd():
385385 IndexError , "index 64 is out of bounds for axis 1 with size 64"
386386 ):
387387 G .inverse_transform (G .data_nu , columns = data .shape [1 ])
388+
389+ # Flexible regex pattern that works across Python versions
390+ sparse_error_pattern = ".*sparse.*was passed, but dense data is required.*toarray.*to convert.*dense.*array.*"
388391 with assert_raises_message (
389392 TypeError ,
390- "Sparse data was passed, but dense data is required. Use '.toarray()' to convert to a dense numpy array." ,
393+ sparse_error_pattern ,
391394 ):
392395 G .inverse_transform (sp .csr_matrix (G .data )[:, 0 ])
393396 with assert_raises_message (
394397 TypeError ,
395- "Sparse data was passed, but dense data is required. Use '.toarray()' to convert to a dense numpy array." ,
398+ sparse_error_pattern ,
396399 ):
397400 G .inverse_transform (sp .csr_matrix (G .data )[:, :15 ])
398401 with assert_raises_message (
You can’t perform that action at this time.
0 commit comments