Author: Matti Picus <[email protected]>
Branch: 
Changeset: r65113:9918529ceecd
Date: 2013-06-30 00:55 +0300
http://bitbucket.org/pypy/pypy/changeset/9918529ceecd/

Log:    test, fix missing method in ScalarIterator

diff --git a/pypy/module/micronumpy/arrayimpl/scalar.py 
b/pypy/module/micronumpy/arrayimpl/scalar.py
--- a/pypy/module/micronumpy/arrayimpl/scalar.py
+++ b/pypy/module/micronumpy/arrayimpl/scalar.py
@@ -13,6 +13,9 @@
     def next(self):
         self.called_once = True
 
+    def next_skip_x(self, n):
+        self.called_once = True
+
     def getitem(self):
         return self.v.get_scalar_value()
 
diff --git a/pypy/module/micronumpy/iter.py b/pypy/module/micronumpy/iter.py
--- a/pypy/module/micronumpy/iter.py
+++ b/pypy/module/micronumpy/iter.py
@@ -37,7 +37,7 @@
 we can go faster.
 All the calculations happen in next()
 
-next_skip_x() tries to do the iteration for a number of steps at once,
+next_skip_x(steps) tries to do the iteration for a number of steps at once,
 but then we cannot gaurentee that we only overflow one single shape
 dimension, perhaps we could overflow times in one big step.
 """
diff --git a/pypy/module/micronumpy/test/test_iter.py 
b/pypy/module/micronumpy/test/test_iter.py
--- a/pypy/module/micronumpy/test/test_iter.py
+++ b/pypy/module/micronumpy/test/test_iter.py
@@ -1,4 +1,5 @@
 from pypy.module.micronumpy.iter import MultiDimViewIterator
+from pypy.module.micronumpy.arrayimpl.scalar import ScalarIterator
 
 class MockArray(object):
     size = 1
@@ -8,7 +9,7 @@
         #Let's get started, simple iteration in C order with
         #contiguous layout => strides[-1] is 1
         start = 0
-        shape = [3, 5] 
+        shape = [3, 5]
         strides = [5, 1]
         backstrides = [x * (y - 1) for x,y in zip(strides, shape)]
         assert backstrides == [10, 4]
@@ -47,7 +48,7 @@
         #iteration in C order with #contiguous layout => strides[-1] is 1
         #skip less than the shape
         start = 0
-        shape = [3, 5] 
+        shape = [3, 5]
         strides = [5, 1]
         backstrides = [x * (y - 1) for x,y in zip(strides, shape)]
         assert backstrides == [10, 4]
@@ -89,3 +90,9 @@
         assert i.indexes == [0,1]
         assert i.offset == 3
         assert i.done()
+
+    def test_scalar_iter(self):
+        i = ScalarIterator(MockArray)
+        i.next()
+        i.next_skip_x(3)
+        assert i.done()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to