Review report

bitcoin/bitcoin: PR #36257

2 suggestions

Optional improvements

Link

[suggestion] · Boolean assertion failures omit the rejected value

The new functional-test helpers omit the received value from failures, losing diagnostic detail previously provided by assert_equal, particularly when an expression returns a non-boolean.

Location: test/functional/test_framework/util.py:90 (head).

Details and suggested fix

Both helpers raise a fixed message, so a failure cannot distinguish the opposite boolean from a non-boolean rejected by the identity check. For example, assert_true(info.get('solvable')) in wallet_address_types.py would receive None if the key were absent. The previous assertion reported not(None == True), whereas framework exception logging now shows the traceback without that argument value. Include {expression!r} in both failure messages, for example f"Expected True, got {expression!r}", while retaining the identity checks. This restores diagnostic detail without changing which inputs pass.


Link

[suggestion] · Helper documentation omits strict boolean acceptance

The new helpers' documentation omits their identity-check contract, which is stricter than truthiness and the equality checks they replace.

Location: test/functional/test_framework/util.py:88 (head).

Details and suggested fix

The assert_true docstring mentions only resistance to optimization, and assert_false has no docstring. Their identity checks require exactly True or False: non-booleans such as 1, 0, [] and None fail even though some satisfy the corresponding truthiness or equality check. For example, assert_equal(1, True) passed before this conversion, but assert_true(1) fails. The bool annotation does not enforce the input type at runtime. State the exact boolean requirement in both docstrings, retaining the optimization note, so future callers can see the intended contract without inspecting the implementation.


Coverage details