1 suggestion
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · Boolean assertion failures omit the evaluated value
The new functional-test helpers omit values that the replaced equality assertions reported, making failures less informative even though tracebacks still identify the call site.
Location: test/functional/test_framework/util.py:90 (head).
Details and suggested fix
Both helpers raise fixed messages, so assert_true(info.get('solvable')) reports the same failure when the key is missing (None) as when its value is False. The previous equality assertion distinguished these cases in its exception text. Strict identity also rejects non-boolean values such as 1, making the actual value useful when diagnosing a rejection. Include {expression!r} in each failure message, for example raise AssertionError(f"Expected True, got {expression!r}"), with the corresponding message for False. This preserves the identity guards and optimization resistance without changing call sites.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Helper documentation omits strict boolean acceptance (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
assert_true was deferred to disentangle restoring dormant checks from introducing a new assertion API, amid unresolved objections—not because the discussion conclusively rejected boolean helpers. l0rinc repeatedly requested that separation; maflcko expressed an approach objection concerning PYTHONOPTIMIZE; the author ultimately announced a stripped-down version and deferred the helper.
The earlier withdrawal is process and scope history relevant to introducing shared helpers now. It does not establish that assert_equal must remain the boolean-check API or that strict identity was rejected.
Source 1 · Source 2 · Source 3
The stated benefit of assert_true was readability: the expected boolean appears at the beginning rather than after a potentially line-long expression. Consistency with existing equality checks was a competing consideration, and a separate proposal with a scripted conversion was requested to demonstrate the benefit.
This directly explains the API motivation for replacing assert_equal(expression, True/False), independently of optimization behavior. The pinned change applies that presentation choice across many functional tests.
Source 1 · Source 2 · Source 3
The earlier helper’s acceptance of non-boolean truthy values was explicitly challenged: reviewers noted that assert_true("abc"), assert_true(3), and assert_true(1) could pass. The author added type annotations and cited mypy checking, while acknowledging substantial unrelated type-checking errors; l0rinc emphasized that annotations do not prevent runtime acceptance.
This is the most directly relevant historical semantic concern. The pinned head uses is not True and is not False, imposing runtime boolean identity rather than relying on annotations or truthiness. The inspected discussion raised the problem but did not settle an exact runtime contract.
Source 1 · Source 2 · Source 3 · Source 4
Diagnostic improvements were explicitly distinguished from this helper proposal. When related assertion work was mentioned, the author explained that #23119 concerned displaying the values responsible for failure, whereas this proposal had a different purpose.
The pinned base assert_equal includes compared values in failures; the new helpers emit fixed messages. The inspected #31874 discussion recognizes value-reporting as a separate objective, but does not establish a requirement either to preserve those diagnostics or to dispense with them.
Ralph's inferences
The historical concern supports distinguishing actual booleans from truthy inputs, but is not evidence of an agreed compatibility requirement for replacing equality checks. Equality and boolean identity are different contracts: the pinned base permits values equal to True or False, including 1 or 0, whereas the pinned head helpers require the boolean singletons.
Strict identity addresses the kind of non-boolean acceptance raised previously, while also being stricter than the equality checks being replaced. Neither preservation of numeric equality compatibility nor this precise identity-based solution was established by the inspected historical record.
Unresolved disagreements
The optimization rationale remained disputed. maflcko questioned whether optimized test execution occurred in practice and argued that, if addressed, startup rejection and systematic enforcement were preferable to piecemeal replacement. The author was open to startup rejection but cited a distinction between internal sanity assertions and test-condition checks; maflcko questioned that distinction for developer-only test scripts.
The pinned helper documents that it cannot be optimized away. Earlier discussion did not establish that optimization resistance required this API, nor a settled boundary between built-in assert and shared helpers. Withdrawal deferred that debate rather than resolving it.