Author: mattip <[email protected]>
Branch: 
Changeset: r77385:bcc0d42ab17f
Date: 2015-05-19 00:08 +0300
http://bitbucket.org/pypy/pypy/changeset/bcc0d42ab17f/

Log:    rework failing tests

diff --git a/pypy/module/micronumpy/test/test_iterators.py 
b/pypy/module/micronumpy/test/test_iterators.py
--- a/pypy/module/micronumpy/test/test_iterators.py
+++ b/pypy/module/micronumpy/test/test_iterators.py
@@ -1,5 +1,7 @@
 from pypy.module.micronumpy import support
 from pypy.module.micronumpy.iterators import ArrayIter
+from pypy.module.micronumpy.strides import is_c_contiguous, is_f_contiguous
+from pypy.module.micronumpy import constants as NPY
 
 
 class MockArray(object):
@@ -12,6 +14,10 @@
         self.shape = shape
         self.strides = strides
         self.start = start
+        if is_c_contiguous(self):
+            self.flags |= NPY.ARRAY_C_CONTIGUOUS
+        if is_f_contiguous(self):
+            self.flags |= NPY.ARRAY_F_CONTIGUOUS
 
     def get_shape(self):
         return self.shape
diff --git a/pypy/module/micronumpy/test/test_ndarray.py 
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -258,17 +258,6 @@
         # test uninitialized value crash?
         assert len(str(a)) > 0
 
-        import sys
-        for order in [False, True, 'C', 'F']:
-            a = ndarray.__new__(ndarray, (2, 3), float, order=order)
-            assert a.shape == (2, 3)
-            if order in [True, 'F'] and '__pypy__' not in 
sys.builtin_module_names:
-                assert a.flags['F']
-                assert not a.flags['C']
-            else:
-                assert a.flags['C']
-                assert not a.flags['F']
-
         x = array([[0, 2], [1, 1], [2, 0]])
         y = array(x.T, dtype=float)
         assert (y == x.T).all()
@@ -2588,6 +2577,18 @@
         assert a[0][1][1] == 13
         assert a[1][2][1] == 15
 
+    def test_create_order(self):
+        import sys, numpy as np
+        for order in [False, True, 'C', 'F']:
+            a = np.empty((2, 3), float, order=order)
+            assert a.shape == (2, 3)
+            if order in [True, 'F'] and '__pypy__' not in 
sys.builtin_module_names:
+                assert a.flags['F']
+                assert not a.flags['C']
+            else:
+                assert a.flags['C'], "flags['C'] False for %r" % order
+                assert not a.flags['F']
+
     def test_setitem_slice(self):
         import numpy
         a = numpy.zeros((3, 4))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to