diff options
author | Fred Drake <fdrake@acm.org> | 2000-09-28 04:25:33 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-09-28 04:25:33 (GMT) |
commit | 954383356f9d6e69b0dcfe73773f2fb8158a0dd0 (patch) | |
tree | f625bd12695703f23a1b5d657439e07d0bd18094 | |
parent | e0a7f4f9d52acd8fccaa80fd9976325748f6b070 (diff) | |
download | cpython-954383356f9d6e69b0dcfe73773f2fb8158a0dd0.zip cpython-954383356f9d6e69b0dcfe73773f2fb8158a0dd0.tar.gz cpython-954383356f9d6e69b0dcfe73773f2fb8158a0dd0.tar.bz2 |
Added some tests for the truncate() method; one is commented out because
cStringIO does not get it right (reported as SF bug #115531).
Added test for ValueError when write() is called on a closed StringIO
object. Commented out because cStringIO does not get it right
(reported as SF bug #115530).
-rw-r--r-- | Lib/test/output/test_StringIO | 2 | ||||
-rw-r--r-- | Lib/test/test_StringIO.py | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/output/test_StringIO b/Lib/test/output/test_StringIO index 505023a..ce983c0 100644 --- a/Lib/test/output/test_StringIO +++ b/Lib/test/output/test_StringIO @@ -3,7 +3,9 @@ abcdefghij klmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 2 +'abcdefghij' abcdefghij klmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 2 +'abcdefghij' diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py index 6e321e9..2d9f2c1 100644 --- a/Lib/test/test_StringIO.py +++ b/Lib/test/test_StringIO.py @@ -9,6 +9,29 @@ def do_test(module): print f.readline() print len(f.readlines(60)) + f = module.StringIO() + f.write(s) + f.seek(10) + f.truncate() + print `f.getvalue()` + # This test fails for cStringIO; reported as SourceForge bug #115531; + # please uncomment this test when that bug is fixed. + # http://sourceforge.net/bugs/?func=detailbug&bug_id=115531&group_id=5470 +## f.seek(0) +## f.truncate(5) +## print `f.getvalue()` + + # This test fails for cStringIO; reported as SourceForge bug #115530; + # please uncomment this test when that bug is fixed. + # http://sourceforge.net/bugs/?func=detailbug&bug_id=115530&group_id=5470 +## try: +## f.write("frobnitz") +## except ValueError, e: +## print "Caught expected ValueError writing to closed StringIO:" +## print e +## else: +## print "Failed to catch ValueError writing to closed StringIO." + # Don't bother testing cStringIO without import StringIO, cStringIO do_test(StringIO) |