Try a simple do_put call with metadata.
()
| 1857 | |
| 1858 | |
| 1859 | def test_flight_do_put_metadata(): |
| 1860 | """Try a simple do_put call with metadata.""" |
| 1861 | data = [ |
| 1862 | pa.array([-10, -5, 0, 5, 10]) |
| 1863 | ] |
| 1864 | table = pa.Table.from_arrays(data, names=['a']) |
| 1865 | |
| 1866 | with MetadataFlightServer() as server, \ |
| 1867 | FlightClient(('localhost', server.port)) as client: |
| 1868 | writer, metadata_reader = client.do_put( |
| 1869 | flight.FlightDescriptor.for_path(''), |
| 1870 | table.schema) |
| 1871 | with writer: |
| 1872 | for idx, batch in enumerate(table.to_batches(max_chunksize=1)): |
| 1873 | metadata = struct.pack('<i', idx) |
| 1874 | writer.write_with_metadata(batch, metadata) |
| 1875 | buf = metadata_reader.read() |
| 1876 | assert buf is not None |
| 1877 | server_idx, = struct.unpack('<i', buf.to_pybytes()) |
| 1878 | assert idx == server_idx |
| 1879 | |
| 1880 | |
| 1881 | @pytest.mark.numpy |
nothing calls this directly
no test coverage detected