MCPcopy Create free account
hub / github.com/apache/arrow / test_repr

Function test_repr

python/pyarrow/tests/test_flight.py:928–1002  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

926
927
928def test_repr():
929 action_repr = "<pyarrow.flight.Action type='foo' body=(0 bytes)>"
930 action_type_repr = "ActionType(type='foo', description='bar')"
931 basic_auth_repr = "<pyarrow.flight.BasicAuth username=b'user' password=(redacted)>"
932 descriptor_repr = "<pyarrow.flight.FlightDescriptor cmd=b'foo'>"
933 endpoint_repr = ("<pyarrow.flight.FlightEndpoint "
934 "ticket=<pyarrow.flight.Ticket ticket=b'foo'> "
935 "locations=[] "
936 "expiration_time=2023-04-05 12:34:56+00:00 "
937 "app_metadata=b'endpoint app metadata'>")
938 info_repr = (
939 "<pyarrow.flight.FlightInfo "
940 "schema= "
941 "descriptor=<pyarrow.flight.FlightDescriptor path=[]> "
942 "endpoints=[] "
943 "total_records=1 "
944 "total_bytes=42 "
945 "ordered=True "
946 "app_metadata=b'test app metadata'>")
947 location_repr = "<pyarrow.flight.Location b'grpc+tcp://localhost:1234'>"
948 result_repr = "<pyarrow.flight.Result body=(3 bytes)>"
949 schema_result_repr = "<pyarrow.flight.SchemaResult schema=()>"
950 ticket_repr = "<pyarrow.flight.Ticket ticket=b'foo'>"
951
952 assert repr(flight.Action("foo", b"")) == action_repr
953 assert repr(flight.ActionType("foo", "bar")) == action_type_repr
954 assert repr(flight.BasicAuth("user", "pass")) == basic_auth_repr
955 assert repr(flight.FlightDescriptor.for_command("foo")) == descriptor_repr
956 endpoint = flight.FlightEndpoint(
957 b"foo", [], pa.scalar("2023-04-05T12:34:56").cast(pa.timestamp("s")),
958 b"endpoint app metadata"
959 )
960 assert repr(endpoint) == endpoint_repr
961 info = flight.FlightInfo(
962 pa.schema([]), flight.FlightDescriptor.for_path(), [],
963 1, 42, True, b"test app metadata"
964 )
965 assert repr(info) == info_repr
966 assert repr(flight.Location("grpc+tcp://localhost:1234")) == location_repr
967 assert repr(flight.Result(b"foo")) == result_repr
968 assert repr(flight.SchemaResult(pa.schema([]))) == schema_result_repr
969 assert repr(flight.SchemaResult(pa.schema([("int", "int64")]))) == \
970 "<pyarrow.flight.SchemaResult schema=(int: int64)>"
971 assert repr(flight.Ticket(b"foo")) == ticket_repr
972 assert info.schema == pa.schema([])
973
974 info = flight.FlightInfo(
975 None, flight.FlightDescriptor.for_path(), [],
976 1, 42, True, b"test app metadata"
977 )
978 info_repr = (
979 "<pyarrow.flight.FlightInfo "
980 "schema=None "
981 "descriptor=<pyarrow.flight.FlightDescriptor path=[]> "
982 "endpoints=[] "
983 "total_records=1 "
984 "total_bytes=42 "
985 "ordered=True "

Callers

nothing calls this directly

Calls 5

LocationMethod · 0.80
ResultMethod · 0.80
castMethod · 0.45
scalarMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected