Skip to content
Snippets Groups Projects
Commit cba723fc authored by Rami Ali's avatar Rami Ali Committed by Damien George
Browse files

tests/io: Improve test coverage of io.BufferedWriter.

parent 96baaa68
Branches
Tags
No related merge requests found
...@@ -20,3 +20,9 @@ buf.flush() ...@@ -20,3 +20,9 @@ buf.flush()
print(bts.getvalue()) print(bts.getvalue())
buf.flush() buf.flush()
print(bts.getvalue()) print(bts.getvalue())
# special case when alloc is a factor of total buffer length
bts = io.BytesIO()
buf = io.BufferedWriter(bts, 1)
buf.write(b"foo")
print(bts.getvalue())
...@@ -2,3 +2,4 @@ b'' ...@@ -2,3 +2,4 @@ b''
b'foobarfo' b'foobarfo'
b'foobarfoobar' b'foobarfoobar'
b'foobarfoobar' b'foobarfoobar'
b'foo'
...@@ -6,6 +6,7 @@ except NameError: ...@@ -6,6 +6,7 @@ except NameError:
sys.exit() sys.exit()
import uerrno import uerrno
import uio
data = extra_coverage() data = extra_coverage()
...@@ -45,6 +46,11 @@ except OSError: ...@@ -45,6 +46,11 @@ except OSError:
print('OSError') print('OSError')
print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream
# test BufferedWriter with stream errors
stream.set_error(uerrno.EAGAIN)
buf = uio.BufferedWriter(stream, 8)
print(buf.write(bytearray(16)))
# test basic import of frozen scripts # test basic import of frozen scripts
import frzstr1 import frzstr1
import frzmpy1 import frzmpy1
......
...@@ -61,6 +61,7 @@ OSError ...@@ -61,6 +61,7 @@ OSError
0 0
OSError OSError
None None
None
frzstr1 frzstr1
frzmpy1 frzmpy1
frzstr_pkg1.__init__ frzstr_pkg1.__init__
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment