def tobs(data): ''' Transforms bytes or unicode into a byte stream. ''' return BytesIO(tob(data))
def test_save_buffer(self): fu = FileUpload(open(__file__, 'rb'), 'testfile', __file__) buff = BytesIO() fu.save(buff) buff.seek(0) self.assertEqual(fu.file.read(), buff.read())
def tobs(data): """ Transforms bytes or unicode into a byte stream. """ return BytesIO(tob(data))