Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(533)

Unified Diff: Lib/test/test_bufio.py

Issue 22061: [issue4565] Rewrite the IO stack in C (Closed) Base URL: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: Created 15 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Lib/_pyio.py ('K') | « Lib/io.py ('k') | Lib/test/test_descr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« Lib/_pyio.py ('K') | « Lib/io.py ('k') | Lib/test/test_descr.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b