[pypy-commit] pypy array_equal: add some array_equal tests

MichaelBlume noreply at buildbot.pypy.org
Thu Mar 22 17:08:23 CET 2012


Author: Mike Blume <mike at loggly.com>
Branch: array_equal
Changeset: r53904:e48874635097
Date: 2012-03-12 23:17 -0700
http://bitbucket.org/pypy/pypy/changeset/e48874635097/

Log:	add some array_equal tests

diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -203,6 +203,44 @@
         assert a.shape == (3,)
         assert a.dtype is dtype(int)
 
+    def test_equal(self):
+        from _numpypy import array
+        from numpypy import array_equal
+        
+        a = [1, 2, 3]
+        b = [1, 2, 3]
+        
+        assert array_equal(a, b)
+        assert array_equal(a, array(b))
+        assert array_equal(array(a), b)
+        assert array_equal(array(a), array(b))
+
+    def test_not_equal(self):
+        from _numpypy import array
+        from numpypy import array_equal
+        
+        a = [1, 2, 3]
+        b = [1, 2, 4]
+        
+        assert not array_equal(a, b)
+        assert not array_equal(a, array(b))
+        assert not array_equal(array(a), b)
+        assert not array_equal(array(a), array(b))
+
+    def test_mismatched_shape(self):
+        from _numpypy import array
+        from numpypy import array_equal
+        
+        a = [1, 2, 3]
+        b = [[1, 2, 3], [1, 2, 3]]
+        
+        assert not array_equal(a, b)
+        assert not array_equal(a, array(b))
+        assert not array_equal(array(a), b)
+        assert not array_equal(array(a), array(b))
+
+
+
     def test_type(self):
         from _numpypy import array
         ar = array(range(5))


More information about the pypy-commit mailing list