1import uio as io
2
3try:
4    io.BytesIO
5    io.BufferedWriter
6except AttributeError:
7    print('SKIP')
8    raise SystemExit
9
10bts = io.BytesIO()
11buf = io.BufferedWriter(bts, 8)
12
13buf.write(b"foobar")
14print(bts.getvalue())
15buf.write(b"foobar")
16# CPython has different flushing policy, so value below is different
17print(bts.getvalue())
18buf.flush()
19print(bts.getvalue())
20buf.flush()
21print(bts.getvalue())
22
23# special case when alloc is a factor of total buffer length
24bts = io.BytesIO()
25buf = io.BufferedWriter(bts, 1)
26buf.write(b"foo")
27print(bts.getvalue())
28