def test_fileobj_copy_partial(self): inobj = io.BytesIO('adatab') outobj = io.BytesIO() inobj.read(1) isolateserver.fileobj_copy(outobj, inobj, size=4) self.assertEqual('data', outobj.getvalue())
def test_fileobj_copy_partial_file_no_size(self): with self.assertRaises(IOError): inobj = io.BytesIO('hello') outobj = io.BytesIO() inobj.read(1) isolateserver.fileobj_copy(outobj, inobj)
def test_fileobj_copy_size_but_file_short(self): with self.assertRaises(IOError): inobj = io.BytesIO('hello') outobj = io.BytesIO() isolateserver.fileobj_copy(outobj, inobj, size=10)
def test_fileobj_copy_simple(self): inobj = io.BytesIO('hello') outobj = io.BytesIO() isolateserver.fileobj_copy(outobj, inobj) self.assertEqual('hello', outobj.getvalue())