blob: 6e321e930f7e023c8a33202a1f903779cdc0e261 [file] [log] [blame]
Jeremy Hyltond635b1d2000-09-26 17:32:27 +00001# Tests StringIO and cStringIO
Guido van Rossum8d691c82000-09-01 19:25:51 +00002
Jeremy Hyltond635b1d2000-09-26 17:32:27 +00003import string
Guido van Rossum8d691c82000-09-01 19:25:51 +00004
Jeremy Hyltond635b1d2000-09-26 17:32:27 +00005def do_test(module):
6 s = (string.letters+'\n')*5
7 f = module.StringIO(s)
8 print f.read(10)
9 print f.readline()
10 print len(f.readlines(60))
Guido van Rossum3e06ab12000-06-29 19:35:29 +000011
Jeremy Hyltond635b1d2000-09-26 17:32:27 +000012# Don't bother testing cStringIO without
13import StringIO, cStringIO
14do_test(StringIO)
15do_test(cStringIO)