Try a simple do_put call with a size limit.
()
| 1918 | |
| 1919 | @pytest.mark.numpy |
| 1920 | def test_flight_do_put_limit(): |
| 1921 | """Try a simple do_put call with a size limit.""" |
| 1922 | large_batch = pa.RecordBatch.from_arrays([ |
| 1923 | pa.array(np.ones(768, dtype=np.int64())), |
| 1924 | ], names=['a']) |
| 1925 | |
| 1926 | with EchoFlightServer() as server, \ |
| 1927 | FlightClient(('localhost', server.port), |
| 1928 | write_size_limit_bytes=4096) as client: |
| 1929 | writer, metadata_reader = client.do_put( |
| 1930 | flight.FlightDescriptor.for_path(''), |
| 1931 | large_batch.schema) |
| 1932 | with writer: |
| 1933 | with pytest.raises(flight.FlightWriteSizeExceededError, |
| 1934 | match="exceeded soft limit") as excinfo: |
| 1935 | writer.write_batch(large_batch) |
| 1936 | assert excinfo.value.limit == 4096 |
| 1937 | smaller_batches = [ |
| 1938 | large_batch.slice(0, 384), |
| 1939 | large_batch.slice(384), |
| 1940 | ] |
| 1941 | for batch in smaller_batches: |
| 1942 | writer.write_batch(batch) |
| 1943 | expected = pa.Table.from_batches([large_batch]) |
| 1944 | actual = client.do_get(flight.Ticket(b'')).read_all() |
| 1945 | assert expected == actual |
| 1946 | |
| 1947 | |
| 1948 | @pytest.mark.slow |
nothing calls this directly
no test coverage detected