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

Function test_schema_serialization_with_metadata

python/pyarrow/tests/test_ipc.py:1148–1163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1146
1147
1148def test_schema_serialization_with_metadata():
1149 field_metadata = {b'foo': b'bar', b'kind': b'field'}
1150 schema_metadata = {b'foo': b'bar', b'kind': b'schema'}
1151
1152 f0 = pa.field('a', pa.int8())
1153 f1 = pa.field('b', pa.string(), metadata=field_metadata)
1154
1155 schema = pa.schema([f0, f1], metadata=schema_metadata)
1156
1157 s_schema = schema.serialize()
1158 recons_schema = pa.ipc.read_schema(s_schema)
1159
1160 assert recons_schema.equals(schema)
1161 assert recons_schema.metadata == schema_metadata
1162 assert recons_schema[0].metadata is None
1163 assert recons_schema[1].metadata == field_metadata
1164
1165
1166def write_file(batch, sink):

Callers

nothing calls this directly

Calls 5

equalsMethod · 0.80
fieldMethod · 0.45
stringMethod · 0.45
schemaMethod · 0.45
read_schemaMethod · 0.45

Tested by

no test coverage detected