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

Function test_encode

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

Source from the content-addressed store, hash-verified

86
87
88def test_encode():
89 print(foo_schema())
90 encoder = pyfory.create_row_encoder(foo_schema())
91 foo = create_foo()
92 print("foo", foo)
93 row = encoder.to_row(foo)
94 print("row bytes length", len(row.to_bytes()))
95 print("row bytes", row.to_bytes())
96 print("row", row) # test __str__
97 new_foo = encoder.from_row(row)
98 print("new_foo", new_foo)
99 assert foo.f1 == new_foo.f1
100 assert foo.f2 == new_foo.f2
101 assert foo.f3 == new_foo.f3
102 assert foo.f4 == new_foo.f4
103 assert foo.f5 == new_foo.f5
104 assert foo.f6 == new_foo.f6
105
106
107def test_row_and_array_reject_one_past_end_index():

Callers

nothing calls this directly

Calls 5

from_rowMethod · 0.80
foo_schemaFunction · 0.70
create_fooFunction · 0.70
to_rowMethod · 0.45
to_bytesMethod · 0.45

Tested by

no test coverage detected