Author: mattip <[email protected]>
Branch: missing-ndarray-attributes
Changeset: r60160:75ac8c51f417
Date: 2013-01-18 01:27 +0200
http://bitbucket.org/pypy/pypy/changeset/75ac8c51f417/

Log:    add some failing 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
@@ -1634,7 +1634,29 @@
         assert (a == [1, 256 + 2, 3]).all()
         assert (a.byteswap(True) == [0x0100, 0x0201, 0x0300]).all()
         assert (a == [0x0100, 0x0201, 0x0300]).all()
-        assert False, 'test float, float16, complex byteswap'
+
+        a = array([1, -1, 1e300], dtype=float)
+        s1 = map(ord,a.tostring())
+        s2 = map(ord, a.byteswap().tostring())
+        assert s1[7::-1] == s2[:8]
+        assert s1[15:7:-1] == s2[8:16]
+        assert s1[:15:-1] == s2[16:]
+
+        a = array([1+1e30j, -1, 1e10], dtype=complex)
+        s1 = map(ord,a.tostring())
+        s2 = map(ord, a.byteswap().tostring())
+        assert s1[7::-1] == s2[:8]
+        assert s1[15:7:-1] == s2[8:16]
+        assert s1[23:15:-1] == s2[16:24]
+        assert s1[31:23:-1] == s2[24:32]
+        assert s1[39:31:-1] == s2[32:40]
+        assert s1[:39:-1] == s2[40:]
+
+        a = array([1, -1, 10000], dtype='float16')
+        s1 = map(ord,a.tostring())
+        s2 = map(ord, a.byteswap().tostring())
+        s3 = [s1[1], s1[0],s1[3], s1[2], s1[5], s1[4]]
+        assert s3 == s2
 
     def test_clip(self):
         from _numpypy import array
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to