Skip to content

Commit 09b6d88

Browse files
committed
Fix error handling in least_squares tests
1 parent 2c88594 commit 09b6d88

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

ndarray-linalg/src/least_squares.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -719,20 +719,14 @@ mod tests {
719719
// Testing error cases
720720
//
721721
use crate::layout::MatrixLayout;
722-
use ndarray::ErrorKind;
723722

724723
#[test]
725724
fn test_incompatible_shape_error_on_mismatching_num_rows() {
726725
let a: Array2<f64> = array![[1., 2.], [4., 5.], [3., 4.]];
727726
let b: Array1<f64> = array![1., 2.];
728727
let res = a.least_squares(&b);
729728
match res {
730-
Err(err) => match err {
731-
LinalgError::Shape(shape_error) => {
732-
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape)
733-
}
734-
_ => panic!("Expected ShapeError"),
735-
},
729+
Err(LinalgError::Lapack(err)) if matches!(err, lapack::error::Error::InvalidShape) => {}
736730
_ => panic!("Expected Err()"),
737731
}
738732
}
@@ -745,12 +739,7 @@ mod tests {
745739

746740
let res = a.least_squares(&b);
747741
match res {
748-
Err(err) => match err {
749-
LinalgError::Shape(shape_error) => {
750-
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape)
751-
}
752-
_ => panic!("Expected ShapeError"),
753-
},
742+
Err(LinalgError::Lapack(err)) if matches!(err, lapack::error::Error::InvalidShape) => {}
754743
_ => panic!("Expected Err()"),
755744
}
756745
}

0 commit comments

Comments
 (0)