2000-09-26 14:32:27 -03:00
|
|
|
# Tests StringIO and cStringIO
|
2000-09-01 16:25:51 -03:00
|
|
|
|
2000-09-26 14:32:27 -03:00
|
|
|
import string
|
2000-06-29 16:35:29 -03:00
|
|
|
|
2000-09-26 14:32:27 -03:00
|
|
|
def do_test(module):
|
|
|
|
s = (string.letters+'\n')*5
|
|
|
|
f = module.StringIO(s)
|
|
|
|
print f.read(10)
|
|
|
|
print f.readline()
|
|
|
|
print len(f.readlines(60))
|
1996-09-11 16:07:45 -03:00
|
|
|
|
2000-09-26 14:32:27 -03:00
|
|
|
# Don't bother testing cStringIO without
|
|
|
|
import StringIO, cStringIO
|
|
|
|
do_test(StringIO)
|
|
|
|
do_test(cStringIO)
|