MCPcopy Create free account
hub / github.com/apache/arrow / test_open_append_stream

Function test_open_append_stream

python/pyarrow/tests/test_fs.py:1099–1120  ·  view source on GitHub ↗
(fs, pathfn, compression, buffer_size, compressor,
                            decompressor, allow_append_to_file)

Source from the content-addressed store, hash-verified

1097 ]
1098)
1099def test_open_append_stream(fs, pathfn, compression, buffer_size, compressor,
1100 decompressor, allow_append_to_file):
1101 p = pathfn('open-append-stream')
1102
1103 initial = compressor(b'already existing')
1104 with fs.open_output_stream(p) as s:
1105 s.write(initial)
1106
1107 if allow_append_to_file:
1108 with fs.open_append_stream(p, compression=compression,
1109 buffer_size=buffer_size) as f:
1110 f.write(b'\nnewly added')
1111
1112 with fs.open_input_stream(p) as f:
1113 result = f.read()
1114
1115 result = decompressor(result)
1116 assert result == b'already existing\nnewly added'
1117 else:
1118 with pytest.raises(pa.ArrowNotImplementedError):
1119 fs.open_append_stream(p, compression=compression,
1120 buffer_size=buffer_size)
1121
1122
1123def test_open_output_stream_metadata(fs, pathfn):

Callers

nothing calls this directly

Calls 6

pathfnFunction · 0.85
open_output_streamMethod · 0.45
writeMethod · 0.45
open_append_streamMethod · 0.45
open_input_streamMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected