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

Function test_output_stream_destructor

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

check_dataFunction · 0.85

Tested by

no test coverage detected