Test case for for-loop assignment to buffer
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 20 Jul 2008 17:03:31 +0000 (19:03 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 20 Jul 2008 17:03:31 +0000 (19:03 +0200)
tests/run/bufaccess.pyx

index 14981d9eb4bc0c7d069c1a73968c81d84017612a..d30baafbda38816755bd41a9e60d09d4bcea9846 100644 (file)
@@ -39,6 +39,17 @@ __doc__ = u"""
     acquired A
     0 1 2 3 4 5
     released A
+
+    #>>> forin_assignment([A, B, A], 3)
+    acquired A
+    3
+    released A
+    acquired B
+    3
+    released B
+    acquired A
+    3
+    released A   
     
     >>> printbuf_float(MockBuffer("f", [1.0, 1.25, 0.75, 1.0]), (4,))
     acquired
@@ -99,6 +110,11 @@ def cdef_assignment(obj, n):
         print buf[i],
     print
 
+def forin_assignment(objs, int pick):
+    cdef object[int] buf
+    for buf in objs:
+        print buf[pick]
+
 def printbuf_float(o, shape):
     # should make shape builtin
     cdef object[float] buf