diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2013-05-13 08:50:54 -0700 |
|---|---|---|
| committer | Charles Harris <charlesr.harris@gmail.com> | 2013-05-13 08:50:54 -0700 |
| commit | 458b0999e34a83febd3e39c0d53ef39fe1d6dc5c (patch) | |
| tree | 53d6463df70713ac60e109e4f6b2d72ba9682de7 /numpy | |
| parent | 44a796154a4d349768c6e2244b39e8a69d2d1680 (diff) | |
| parent | 92503a5cb8bf52321043294b3b8b8811dd1eaee8 (diff) | |
| download | numpy-458b0999e34a83febd3e39c0d53ef39fe1d6dc5c.tar.gz | |
Merge pull request #3322 from ContinuumIO/array_equal_fix
Fix array_equal and array_equiv issue
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/numeric.py | 4 | ||||
| -rw-r--r-- | numpy/core/tests/test_numeric.py | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index d689982db..a187d7c5b 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -2137,7 +2137,7 @@ def array_equal(a1, a2): return False if a1.shape != a2.shape: return False - return bool(equal(a1,a2).all()) + return bool(asarray(a1 == a2).all()) def array_equiv(a1, a2): """ @@ -2179,7 +2179,7 @@ def array_equiv(a1, a2): except: return False try: - return bool(equal(a1,a2).all()) + return bool(asarray(a1 == a2).all()) except ValueError: return False diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 3a6118f06..5c8de3734 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -656,6 +656,12 @@ class TestArrayComparisons(TestCase): res = array_equal(array([1,2]), array([1,3])) assert_(not res) assert_(type(res) is bool) + res = array_equal(array(['a'], dtype='S1'), array(['a'], dtype='S1')) + assert_(res) + assert_(type(res) is bool) + res = array_equal(array([('a',1)], dtype='S1,u4'), array([('a',1)], dtype='S1,u4')) + assert_(res) + assert_(type(res) is bool) def test_array_equiv(self): res = array_equiv(array([1,2]), array([1,2])) |
