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

Function _assert_roundtrip_eq

tests/python/test_serialization.py:38–49  ·  view source on GitHub ↗

Assert that roundtrip preserves the value.

(obj: Any, cmp: Callable[..., Any] | None = None)

Source from the content-addressed store, hash-verified

36
37
38def _assert_roundtrip_eq(obj: Any, cmp: Callable[..., Any] | None = None) -> None:
39 """Assert that roundtrip preserves the value."""
40 result = _roundtrip(obj)
41 if cmp is not None:
42 cmp(result)
43 elif isinstance(obj, float):
44 assert isinstance(result, float)
45 assert result == pytest.approx(obj)
46 elif obj is None:
47 assert result is None
48 else:
49 _assert_any_equal(result, obj)
50
51
52def _assert_any_equal(a: Any, b: Any) -> None:

Callers 9

test_emptyMethod · 0.85
test_shortMethod · 0.85
test_longMethod · 0.85
test_special_charsMethod · 0.85
test_unicodeMethod · 0.85
test_emptyMethod · 0.85
test_emptyMethod · 0.85
test_emptyMethod · 0.85
test_emptyMethod · 0.85

Calls 2

_roundtripFunction · 0.85
_assert_any_equalFunction · 0.85

Tested by

no test coverage detected