Try a simple do_put call with a size limit.
()
| 1880 | |
| 1881 | @pytest.mark.numpy |
| 1882 | def 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 |
nothing calls this directly
no test coverage detected