Index: Lib/test/test_bufio.py |
=================================================================== |
--- Lib/test/test_bufio.py (.../py3k) (révision 70115) |
+++ Lib/test/test_bufio.py (.../io-c) (révision 70115) |
@@ -1,10 +1,13 @@ |
import unittest |
from test import support |
-# Simple test to ensure that optimizations in fileobject.c deliver |
-# the expected results. For best testing, run this under a debug-build |
-# Python too (to exercise asserts in the C code). |
+import io # C implementation. |
+import _pyio as pyio # Python implementation. |
+# Simple test to ensure that optimizations in the IO library deliver the |
+# expected results. For best testing, run this under a debug-build Python too |
+# (to exercise asserts in the C code). |
+ |
lengths = list(range(1, 257)) + [512, 1000, 1024, 2048, 4096, 8192, 10000, |
16384, 32768, 65536, 1000000] |
@@ -18,7 +21,7 @@ |
# Since C doesn't guarantee we can write/read arbitrary bytes in text |
# files, use binary mode. |
- f = open(support.TESTFN, "wb") |
+ f = self.open(support.TESTFN, "wb") |
try: |
# write once with \n and once without |
f.write(s) |
@@ -58,8 +61,16 @@ |
def test_nullpat(self): |
self.drive_one(bytes(1000)) |
+ |
+class CBufferSizeTest(BufferSizeTest): |
+ open = io.open |
+ |
+class PyBufferSizeTest(BufferSizeTest): |
+ open = staticmethod(pyio.open) |
+ |
+ |
def test_main(): |
- support.run_unittest(BufferSizeTest) |
+ support.run_unittest(CBufferSizeTest, PyBufferSizeTest) |
if __name__ == "__main__": |
test_main() |