Skip to content

Commit bd8aeb9

Browse files
committed
NF - add assert_dt_equal testing function
Tests whether two simple dtypes are equal, allowing for int32 != intp case (on 32 bit)
1 parent b52623a commit bd8aeb9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nibabel/testing/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
''' Utilities for testing '''
1010
from os.path import dirname, abspath, join as pjoin
1111

12+
import numpy as np
13+
1214
# set path to example data
1315
data_path = abspath(pjoin(dirname(__file__), '..', 'tests', 'data'))
1416

@@ -22,3 +24,9 @@
2224
assert_true, assert_false, assert_raises)
2325

2426

27+
def assert_dt_equal(a, b):
28+
""" Assert two numpy dtype specifiers are equal
29+
30+
Avoids failed comparison between int32 / int64 and intp
31+
"""
32+
assert_equal(np.dtype(a).str, np.dtype(b).str)

0 commit comments

Comments
 (0)