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

Function test_singleton_blocks_zero_copy

python/pyarrow/tests/test_pandas.py:3890–3901  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3888
3889
3890def test_singleton_blocks_zero_copy():
3891 # Part of ARROW-3789
3892 t = pa.table([pa.array(np.arange(1000, dtype=np.int64))], ['f0'])
3893
3894 # Zero copy if split_blocks=True
3895 _check_to_pandas_memory_unchanged(t, split_blocks=True)
3896
3897 prior_allocation = pa.total_allocated_bytes()
3898 result = t.to_pandas()
3899 # access private `_values` because the public `values` is made read-only by pandas
3900 assert result['f0']._values.flags.writeable
3901 assert pa.total_allocated_bytes() > prior_allocation
3902
3903
3904def _check_to_pandas_memory_unchanged(obj, **kwargs):

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.45

Tested by

no test coverage detected