41 |
|
|
42 |
def testFileException(self): |
def testFileException(self): |
43 |
"""Test encoding a file which raises an exception""" |
"""Test encoding a file which raises an exception""" |
44 |
f = FileException(100*1024) |
f = FileException(200*1024) # size depends on buffer size |
45 |
new_iter = IterWrappingFile(FileWrappingIter(iter([f, "foo"]))) |
new_iter = IterWrappingFile(FileWrappingIter(iter([f, "foo"]))) |
46 |
f_out = new_iter.next() |
f_out = new_iter.next() |
47 |
assert f_out.read(10000) == "a"*10000 |
assert f_out.read(50000) == "a"*50000 |
48 |
try: buf = f_out.read(100*1024) |
try: buf = f_out.read(190*1024) |
49 |
except IOError: pass |
except IOError: pass |
50 |
else: assert 0, len(buf) |
else: assert 0, len(buf) |
51 |
|
|