def test_hashfs_put_file(fs, filepath): address = fs.put(str(filepath)) assert_file_put(fs, address) with open(address.abspath, "rb") as fileobj: assert fileobj.read() == to_bytes(filepath.read())
def test_hashfs_put_stringio(fs, stringio): address = fs.put(stringio) assert_file_put(fs, address) with open(address.abspath, "rb") as fileobj: assert fileobj.read() == to_bytes(stringio.getvalue())
def test_hashfs_put_file(fs, filepath): address = fs.put(str(filepath)) assert_file_put(fs, address) with open(address.abspath, 'rb') as fileobj: assert fileobj.read() == to_bytes(filepath.read())
def test_hashfs_put_stringio(fs, stringio): address = fs.put(stringio) assert_file_put(fs, address) with open(address.abspath, 'rb') as fileobj: assert fileobj.read() == to_bytes(stringio.getvalue())
def test_hashfs_open(fs, stringio, extension, address_attr): address = fs.put(stringio, extension) fileobj = fs.open(getattr(address, address_attr)) assert isinstance(fileobj, BufferedReader) assert fileobj.read() == to_bytes(stringio.getvalue()) fileobj.close()