diff options
Diffstat (limited to 'numpy/ma/testutils.py')
-rw-r--r-- | numpy/ma/testutils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index a2fde4405..33030489c 100644 --- a/numpy/ma/testutils.py +++ b/numpy/ma/testutils.py @@ -104,7 +104,16 @@ def assert_equal(actual,desired,err_msg=''): raise ValueError(msg) actual = np.array(actual, copy=False, subok=True) desired = np.array(desired, copy=False, subok=True) - if actual.dtype.char in "OSV" and desired.dtype.char in "OSV": + (actual_dtype, desired_dtype) = (actual.dtype, desired.dtype) + if actual_dtype.char == "S" and desired_dtype.char == "S": + return _assert_equal_on_sequences(actual.tolist(), + desired.tolist(), + err_msg='') + elif actual_dtype.char in "OV" and desired_dtype.char in "OV": + if (actual_dtype != desired_dtype) and actual_dtype: + msg = build_err_msg([actual_dtype, desired_dtype], + err_msg, header='', names=('actual', 'desired')) + raise ValueError(msg) return _assert_equal_on_sequences(actual.tolist(), desired.tolist(), err_msg='') |