[Python-checkins] r68085 - sandbox/trunk/iobench/iobench.py

antoine.pitrou python-checkins at python.org
Wed Dec 31 00:33:02 CET 2008


Author: antoine.pitrou
Date: Wed Dec 31 00:33:02 2008
New Revision: 68085

Log:
Add two tests.




Modified:
   sandbox/trunk/iobench/iobench.py

Modified: sandbox/trunk/iobench/iobench.py
==============================================================================
--- sandbox/trunk/iobench/iobench.py	(original)
+++ sandbox/trunk/iobench/iobench.py	Wed Dec 31 00:33:02 2008
@@ -104,6 +104,22 @@
     for i in xrange(0, size - 1, 1000):
         f.seek(i, 0)
 
+ at with_open_mode("r")
+ at with_sizes("medium")
+def read_seek_bytewise(f):
+    """ alternate read & seek one unit """
+    f.seek(0)
+    while f.read(1):
+        f.seek(1, 1)
+
+ at with_open_mode("r")
+ at with_sizes("medium")
+def read_seek_blockwise(f):
+    """ alternate read & seek 1000 units """
+    f.seek(0)
+    while f.read(1000):
+        f.seek(1000, 1)
+
 
 @with_open_mode("w")
 @with_sizes("small")
@@ -200,6 +216,7 @@
     read_bytewise, read_small_chunks, read_lines, read_big_chunks,
     None, read_whole_file, None,
     seek_forward_bytewise, seek_forward_blockwise,
+    read_seek_bytewise, read_seek_blockwise,
 ]
 
 write_tests = [


More information about the Python-checkins mailing list