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

Function test_output_stream_destructor

python/pyarrow/tests/test_io.py:2193–2209  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

2191
2192
2193def test_output_stream_destructor(tmpdir):
2194 # The wrapper returned by pa.output_stream() should respect Python
2195 # file semantics, i.e. destroying it should close the underlying
2196 # file cleanly.
2197 data = b"some test data\n"
2198 file_path = tmpdir / 'output_stream.buffered'
2199
2200 def check_data(file_path, data, **kwargs):
2201 stream = pa.output_stream(file_path, **kwargs)
2202 stream.write(data)
2203 del stream
2204 gc.collect()
2205 with open(str(file_path), 'rb') as f:
2206 return f.read()
2207
2208 assert check_data(file_path, data, buffer_size=0) == data
2209 assert check_data(file_path, data, buffer_size=1024) == data
2210
2211
2212@pytest.mark.gzip

Callers

nothing calls this directly

Calls 1

check_dataFunction · 0.85

Tested by

no test coverage detected