MCPcopy Create free account
hub / github.com/apache/tvm-ffi / test_deep_object_in_object

Function test_deep_object_in_object

tests/python/test_dataclass_compare.py:819–853  ·  view source on GitHub ↗

TestObjectDerived.v_array contains another TestObjectDerived -> 3-level nesting.

()

Source from the content-addressed store, hash-verified

817
818
819def test_deep_object_in_object() -> None:
820 """TestObjectDerived.v_array contains another TestObjectDerived -> 3-level nesting."""
821 inner_a = create_object(
822 "testing.TestObjectDerived",
823 v_i64=1,
824 v_f64=1.0,
825 v_str="inner",
826 v_map=tvm_ffi.Map({}),
827 v_array=tvm_ffi.Array([42]),
828 )
829 a = create_object(
830 "testing.TestObjectDerived",
831 v_i64=0,
832 v_f64=0.0,
833 v_str="outer",
834 v_map=tvm_ffi.Map({}),
835 v_array=tvm_ffi.Array([inner_a]),
836 )
837 inner_b = create_object(
838 "testing.TestObjectDerived",
839 v_i64=1,
840 v_f64=1.0,
841 v_str="inner",
842 v_map=tvm_ffi.Map({}),
843 v_array=tvm_ffi.Array([42]),
844 )
845 b = create_object(
846 "testing.TestObjectDerived",
847 v_i64=0,
848 v_f64=0.0,
849 v_str="outer",
850 v_map=tvm_ffi.Map({}),
851 v_array=tvm_ffi.Array([inner_b]),
852 )
853 assert RecursiveEq(a, b)
854
855
856# ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 4

create_objectFunction · 0.90
RecursiveEqFunction · 0.90
ArrayMethod · 0.80
MapMethod · 0.45

Tested by

no test coverage detected