Emulate DoPut with DoExchange.
()
| 2223 | |
| 2224 | |
| 2225 | def test_doexchange_put(): |
| 2226 | """Emulate DoPut with DoExchange.""" |
| 2227 | data = pa.Table.from_arrays([ |
| 2228 | pa.array(range(0, 10 * 1024)) |
| 2229 | ], names=["a"]) |
| 2230 | batches = data.to_batches(max_chunksize=512) |
| 2231 | |
| 2232 | with ExchangeFlightServer() as server, \ |
| 2233 | FlightClient(("localhost", server.port)) as client: |
| 2234 | descriptor = flight.FlightDescriptor.for_command(b"put") |
| 2235 | writer, reader = client.do_exchange(descriptor) |
| 2236 | with writer: |
| 2237 | writer.begin(data.schema) |
| 2238 | for batch in batches: |
| 2239 | writer.write_batch(batch) |
| 2240 | writer.done_writing() |
| 2241 | chunk = reader.read_chunk() |
| 2242 | assert chunk.data is None |
| 2243 | expected_buf = str(len(batches)).encode("utf-8") |
| 2244 | assert chunk.app_metadata == expected_buf |
| 2245 | # Metadata only message is not counted as an ipc data message |
| 2246 | assert reader.stats.num_messages == 0 |
| 2247 | |
| 2248 | |
| 2249 | def test_doexchange_echo(): |
nothing calls this directly
no test coverage detected