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

Function test_flight_do_put_limit

python/pyarrow/tests/test_flight.py:1882–1907  ·  view source on GitHub ↗

Try a simple do_put call with a size limit.

()

Source from the content-addressed store, hash-verified

1880
1881@pytest.mark.numpy
1882def test_flight_do_put_limit():
1883 """Try a simple do_put call with a size limit."""
1884 large_batch = pa.RecordBatch.from_arrays([
1885 pa.array(np.ones(768, dtype=np.int64())),
1886 ], names=['a'])
1887
1888 with EchoFlightServer() as server, \
1889 FlightClient(('localhost', server.port),
1890 write_size_limit_bytes=4096) as client:
1891 writer, metadata_reader = client.do_put(
1892 flight.FlightDescriptor.for_path(''),
1893 large_batch.schema)
1894 with writer:
1895 with pytest.raises(flight.FlightWriteSizeExceededError,
1896 match="exceeded soft limit") as excinfo:
1897 writer.write_batch(large_batch)
1898 assert excinfo.value.limit == 4096
1899 smaller_batches = [
1900 large_batch.slice(0, 384),
1901 large_batch.slice(384),
1902 ]
1903 for batch in smaller_batches:
1904 writer.write_batch(batch)
1905 expected = pa.Table.from_batches([large_batch])
1906 actual = client.do_get(flight.Ticket(b'')).read_all()
1907 assert expected == actual
1908
1909
1910@pytest.mark.slow

Callers

nothing calls this directly

Calls 7

FlightClientClass · 0.90
EchoFlightServerClass · 0.85
write_batchMethod · 0.80
arrayMethod · 0.45
do_putMethod · 0.45
sliceMethod · 0.45
do_getMethod · 0.45

Tested by

no test coverage detected