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

Function test_output_stream_destructor

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

Source from the content-addressed store, hash-verified

2158
2159
2160def test_output_stream_destructor(tmpdir):
2161 # The wrapper returned by pa.output_stream() should respect Python
2162 # file semantics, i.e. destroying it should close the underlying
2163 # file cleanly.
2164 data = b"some test data\n"
2165 file_path = tmpdir / 'output_stream.buffered'
2166
2167 def check_data(file_path, data, **kwargs):
2168 stream = pa.output_stream(file_path, **kwargs)
2169 stream.write(data)
2170 del stream
2171 gc.collect()
2172 with open(str(file_path), 'rb') as f:
2173 return f.read()
2174
2175 assert check_data(file_path, data, buffer_size=0) == data
2176 assert check_data(file_path, data, buffer_size=1024) == data
2177
2178
2179@pytest.mark.gzip

Callers

nothing calls this directly

Calls 1

check_dataFunction · 0.85

Tested by

no test coverage detected