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

Function test_float16_array_round_trip

python/pyfory/tests/test_serializer.py:273–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271
272
273def test_float16_array_round_trip():
274 fory = Fory(xlang=True, compatible=False, ref=False)
275 values = pyfory.Float16Array.from_values([0.0, 1.0, -2.0])
276 typeinfo = fory.type_resolver.get_type_info(pyfory.Float16Array)
277 assert isinstance(typeinfo.serializer, fory_array_serializer_type(TypeId.FLOAT16_ARRAY))
278 assert typeinfo.type_id == TypeId.FLOAT16_ARRAY
279 decoded = ser_de(fory, values)
280 assert isinstance(decoded, pyfory.Float16Array)
281 assert list(decoded.to_buffer()) == [0x0000, 0x3C00, 0xC000]
282
283
284def test_float16_array_from_values():

Callers

nothing calls this directly

Calls 5

ForyClass · 0.90
ser_deFunction · 0.70
listFunction · 0.50
get_type_infoMethod · 0.45

Tested by

no test coverage detected