tests: Add test for io.BufferedWriter.

This commit is contained in:
Paul Sokolovsky 2016-03-25 15:01:19 +02:00
parent 2c81b9be28
commit 88f60de914
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,22 @@
import _io as io
try:
io.BytesIO
io.BufferedWriter
except AttributeError:
import sys
print('SKIP')
sys.exit()
bts = io.BytesIO()
buf = io.BufferedWriter(bts, 8)
buf.write(b"foobar")
print(bts.getvalue())
buf.write(b"foobar")
# CPython has different flushing policy, so value below is different
print(bts.getvalue())
buf.flush()
print(bts.getvalue())
buf.flush()
print(bts.getvalue())

View file

@ -0,0 +1,4 @@
b''
b'foobarfo'
b'foobarfoobar'
b'foobarfoobar'