Try a simple do_put call with metadata.
()
| 1895 | |
| 1896 | |
| 1897 | def test_flight_do_put_metadata(): |
| 1898 | """Try a simple do_put call with metadata.""" |
| 1899 | data = [ |
| 1900 | pa.array([-10, -5, 0, 5, 10]) |
| 1901 | ] |
| 1902 | table = pa.Table.from_arrays(data, names=['a']) |
| 1903 | |
| 1904 | with MetadataFlightServer() as server, \ |
| 1905 | FlightClient(('localhost', server.port)) as client: |
| 1906 | writer, metadata_reader = client.do_put( |
| 1907 | flight.FlightDescriptor.for_path(''), |
| 1908 | table.schema) |
| 1909 | with writer: |
| 1910 | for idx, batch in enumerate(table.to_batches(max_chunksize=1)): |
| 1911 | metadata = struct.pack('<i', idx) |
| 1912 | writer.write_with_metadata(batch, metadata) |
| 1913 | buf = metadata_reader.read() |
| 1914 | assert buf is not None |
| 1915 | server_idx, = struct.unpack('<i', buf.to_pybytes()) |
| 1916 | assert idx == server_idx |
| 1917 | |
| 1918 | |
| 1919 | @pytest.mark.numpy |
nothing calls this directly
no test coverage detected