Skip to content

Commit 6013343

Browse files
committed
Fix dtypes tests to work with numpy 1 or 2
1 parent da0807f commit 6013343

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dtype.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ mod tests {
826826

827827
use pyo3::{py_run, types::PyTypeMethods};
828828

829-
use crate::npyffi::NPY_NEEDS_PYAPI;
829+
use crate::npyffi::{is_numpy_2, NPY_NEEDS_PYAPI};
830830

831831
#[test]
832832
fn test_dtype_new() {
@@ -855,7 +855,11 @@ mod tests {
855855
dtype_bound::<T>(py).typeobj().qualname().unwrap()
856856
}
857857
Python::with_gil(|py| {
858-
assert_eq!(type_name::<bool>(py), "bool_");
858+
if is_numpy_2(py) {
859+
assert_eq!(type_name::<bool>(py), "bool");
860+
} else {
861+
assert_eq!(type_name::<bool>(py), "bool_");
862+
}
859863

860864
assert_eq!(type_name::<i8>(py), "int8");
861865
assert_eq!(type_name::<i16>(py), "int16");

0 commit comments

Comments
 (0)