test_register_hooks_binds_pending_and_keeps_trampoline_alive¶
Tests › tests/unit/test_pythonic_facade.py
What this test is for
Why it exists
The test says nothing about why.
Given
- —
When
hooks._clear_pending()fake_handle = ctypes.c_void_p(0xCAFE)def my_hook(ctx: dict) -> None: return None
4 more
bound = hooks.register_hooks(fake_handle)handle_key = ctypes.cast(fake_handle, ctypes.c_void_p).value or 0_bindings.entropic_register_hook.assert_called_once()call_args = _bindings.entropic_register_hook.call_args
Then
- · bound equals 1
- · hooks._bound contains handle_key
- · len(hooks._bound[handle_key]) equals 1
- · hooks._bound[handle_key][0].trampoline is not None
- · call_args.args[0] is fake_handle
- · call_args.args[1] equals int(_bindings.EntropicHookPoint.PRE_TOOL_CALL)
tests/unit/test_pythonic_facade.py:113 · its file's page
What it checks (7)
assert bound == 1observesregister_hooksviaboundassert handle_key in hooks._boundnot attributedassert len(hooks._bound[handle_key]) == 1not attributedassert hooks._bound[handle_key][0].trampoline is not Nonenot attributed_bindings.entropic_register_hook.assert_called_once()not attributedassert call_args.args[0] is fake_handlenot attributedassert call_args.args[1] == int(_bindings.EntropicHookPoint.PRE_TOOL_CALL)not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_register_hooks_binds_pending_and_keeps_trampoline_alive→_clear_pending→hook→register_hooksWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-ABI-001 inferred
- REQ-API-005 inferred
- REQ-API-008 inferred
- REQ-HOOK-001 inferred