[pypy-commit] pypy matrixmath: Add responses to REVIEW

mattip noreply at buildbot.pypy.org
Sun Nov 27 22:08:03 CET 2011


Author: mattip
Branch: matrixmath
Changeset: r49866:c2f6dc50e84f
Date: 2011-11-27 23:06 +0200
http://bitbucket.org/pypy/pypy/changeset/c2f6dc50e84f/

Log:	Add responses to REVIEW

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -1208,7 +1208,9 @@
 )
 
 def descr_new_flatiter(space, w_object):
-    assert isinstance(w_object, BaseArray)
+    if not isinstance(w_object, BaseArray):
+        raise OperationError(space.w_TypeError, space.wrap(
+             "cannot create 'numpypy.flatiter' instances"))
     i = FlatIterator(w_object)
     return i
 
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
@@ -954,20 +954,20 @@
         a = array(range(5))
         b = a.T
         assert(b == range(5)).all()
-        a=numpypy.array((range(10),range(20,30)))
-        b=a.T
-        assert(b[:,0] == a[0,:]).all()
+        a = numpypy.array((range(10), range(20, 30)))
+        b = a.T
+        assert(b[:, 0] == a[0, :]).all()
 
     def test_flatiter(self):
-        from numpypy import array
-        a = array([[10,30],[40,60]])
+        from numpypy import array, flatiter
+        a = array([[10, 30], [40, 60]])
         f_iter = a.flat
         assert f_iter.next() == 10
         assert f_iter.next() == 30
         assert f_iter.next() == 40
         assert f_iter.next() == 60
         raises(StopIteration, "f_iter.next()")
-        raises(TypeError, "numpy.flatiter()")
+        raises(TypeError, "flatiter()")
 
 
 class AppTestSupport(object):
@@ -1092,7 +1092,6 @@
         assert a.dtype is dtype(int)
         a = arange(3, 7, 2)
         assert (a == [3, 5]).all()
-        a = arange(3,dtype=float)
+        a = arange(3, dtype=float)
         assert (a == [0., 1., 2.]).all()
         assert a.dtype is dtype(float)
-        


More information about the pypy-commit mailing list