diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-17 14:54:02 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-17 14:57:57 -0800 |
commit | 22d96096bf7d5fb199ca80f2fcd04e8d27815476 (patch) | |
tree | ba1304d57403375b20a7837c9d6909a4799b0d45 /numpy/ma/testutils.py | |
parent | e39a70cffdd40ed2868a574803bd9535289d528d (diff) | |
download | numpy-22d96096bf7d5fb199ca80f2fcd04e8d27815476.tar.gz |
ENH: core: Replace PyArray_CastTo with a call to PyArray_CopyInto
Since CopyInto uses the dtype transfer mechanism to do the copying,
this also fully handles casting. This also exposed a byte order issue
in the dtype transfer code of converting to object arrays.
The switch from position-based structure copying to name-based copying
required a small change to a masked array test as well.
Diffstat (limited to 'numpy/ma/testutils.py')
-rw-r--r-- | numpy/ma/testutils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index 2b69cc4ad..235aac6e4 100644 --- a/numpy/ma/testutils.py +++ b/numpy/ma/testutils.py @@ -77,8 +77,7 @@ def assert_equal_records(a, b): def assert_equal(actual, desired, err_msg=''): - """Asserts that two items are equal. - """ + "Asserts that two items are equal." # Case #1: dictionary ..... if isinstance(desired, dict): if not isinstance(actual, dict): @@ -94,7 +93,10 @@ def assert_equal(actual, desired, err_msg=''): return _assert_equal_on_sequences(actual, desired, err_msg='') if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)): msg = build_err_msg([actual, desired], err_msg,) - if not desired == actual: + try: + if not desired == actual: + raise AssertionError(msg) + except ValueError: raise AssertionError(msg) return # Case #4. arrays or equivalent |