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

Function test_array_pickle_protocol5

python/pyarrow/tests/test_array.py:2497–2511  ·  view source on GitHub ↗
(data, typ, pickle_module)

Source from the content-addressed store, hash-verified

2495
2496@pickle_test_parametrize
2497def test_array_pickle_protocol5(data, typ, pickle_module):
2498 # Test zero-copy pickling with protocol 5 (PEP 574)
2499 array = pa.array(data, type=typ)
2500 addresses = [buf.address if buf is not None else 0
2501 for buf in array.buffers()]
2502
2503 for proto in range(5, pickle_module.HIGHEST_PROTOCOL + 1):
2504 buffers = []
2505 pickled = pickle_module.dumps(array, proto, buffer_callback=buffers.append)
2506 result = pickle_module.loads(pickled, buffers=buffers)
2507 assert array.equals(result)
2508
2509 result_addresses = [buf.address if buf is not None else 0
2510 for buf in result.buffers()]
2511 assert result_addresses == addresses
2512
2513
2514@pytest.mark.numpy

Callers

nothing calls this directly

Calls 5

buffersMethod · 0.80
dumpsMethod · 0.80
loadsMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected