The GitHub Actions job "CI" on tvm-ffi.git/main has succeeded.
Run started by GitHub user junrushao (triggered by junrushao).

Head commit for run:
5796ff4b6b1a765a9181addaeb56ba9b253cfa8b / Junru Shao <[email protected]>
test(python): add comprehensive RecursiveHash test suite (#485)

## Summary

- Expose `RecursiveHash` to the Python FFI API (`_ffi_api.py` stub +
`__all__`)
- Add `TestHash` and `TestCustomHash` reflected test fixture classes to
`tvm_ffi.testing`
- Add comprehensive `test_dataclass_hash.py` covering the full
`RecursiveHash` contract

## Architecture

- Two new reflected test fixture classes registered via C++ reflection:
- **`TestHash`** (`testing.TestHash`): exercises `Hash(false)` field
exclusion on `hash_ignored`
- **`TestCustomHash`** (`testing.TestCustomHash`): exercises
`__ffi_hash__` custom hook (hashes only `key`, ignores `label`)

## Test Coverage

| Category | What's tested |
|---|---|
| Primitives | int, float, bool, str, bytes, None, DataType, Device |
| NaN handling | All NaN payloads hash equal; canonicalization in nested
containers |
| Signed zero | `+0.0` and `-0.0` hash identically |
| Containers | Array, List, Shape, Map, Dict —
equal/different/empty/nested |
| Reflected objects | TestIntPair, inherited fields (3-level), objects
with container fields |
| Field exclusion | `Hash(false)` via TestHash; `Compare(false)` implies
hash-off |
| Custom hooks | `__ffi_hash__` via TestCustomHash and TestCustomCompare
|
| Cycle detection | Self-referential List/Dict hashing succeeds
gracefully |
| Consistency law | `RecursiveEq(a, b) ⟹ RecursiveHash(a) ==
RecursiveHash(b)` — primitives, containers, reflected objects, custom
hooks |
| Aliasing invariants | Shared vs duplicated references produce
identical hashes |
| Recursion depth | 127 and 1000 levels of nesting (iterative heap-based
stack) |
| DAG scaling | Shared binary DAG hashing is linear, not exponential
(warm-up + averaged) |
| Guard | `__ffi_eq__` without `__ffi_hash__` raises ValueError |

## Test Plan

- [x] `uv run pytest -vvs tests/python/test_dataclass_hash.py`

Report URL: https://github.com/apache/tvm-ffi/actions/runs/22510071594

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to