MCPcopy Create free account
hub / github.com/apache/fory / test_binary_row_access

Function test_binary_row_access

python/pyfory/format/tests/test_encoder.py:227–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225
226
227def test_binary_row_access():
228 encoder = pyfory.encoder(FooNested)
229 foo = FooNested(
230 f1=10,
231 f2=list(range(1000)),
232 f3={f"k{i}": i for i in range(1000)},
233 f4=[BarNested(f1=f"s{i}", f2=list(range(10))) for i in range(10)],
234 )
235 binary_data = encoder.to_row(foo).to_bytes()
236 foo_row = pyfory.RowData(encoder.schema, binary_data)
237 print(foo_row.f2[2], foo_row.f4[2].f1, foo_row.f4[2].f2[5])
238
239
240def benchmark_row_access():

Callers

nothing calls this directly

Calls 5

FooNestedClass · 0.85
BarNestedClass · 0.85
listFunction · 0.50
to_bytesMethod · 0.45
to_rowMethod · 0.45

Tested by

no test coverage detected