Skip to content

Commit c01a14c

Browse files
committed
add test case
1 parent 86d13f4 commit c01a14c

File tree

1 file changed

+15
-0
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+15
-0
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_io.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,21 @@ def write(self, x):
262262
def test_writelines_err(self):
263263
self.assertRaises(AttributeError, _io._IOBase().writelines, ['aaa', 'bbb'])
264264

265+
def test_bytesio_unsharing(self):
266+
f = _io.BytesIO()
267+
f.write(b"1234")
268+
first_pickled = f.getvalue()
269+
f.seek(0)
270+
f.truncate()
271+
f.write(b"1234")
272+
second_pickled = f.getvalue()
273+
f.seek(0)
274+
f.truncate()
275+
f.write(b"abcd")
276+
third_pickled = f.getvalue()
277+
self.assertEqual(first_pickled, b'1234')
278+
self.assertEqual(second_pickled, b'1234')
279+
self.assertEqual(third_pickled, b'abcd')
265280

266281
if __name__ == '__main__':
267282
unittest.main()

0 commit comments

Comments
 (0)