#36257 qa: assert_equals -> assert_true/assert_false
https://github.com/bitcoin/bitcoin/pull/36257 · · +637/-511 in 93 files, 5 commits · labels: Tests
Goal
- Make boolean checks in functional tests clearer and more readable for developers
Adds assert_true() and assert_false() helper functions to test_framework/util.py that enforce strict boolean identity. A scripted diff then converts existing assert_equal(..., True) and assert_equal(..., False) invocations across 90+ functional test files to the new helpers.
Problem: Functional test assertions checking boolean results currently use assert_equal(expression, True/False), which can be verbose and slightly less readable for developers skimming test logic.
Category: Test infrastructure (#38 of 45)
P4 · cleanup
- P4 because it is a cosmetic cleanup with no change to test coverage or behavior
- Provides only a minor readability gain when reading test assertions
- Does not fix flakes or improve test execution speed
Cosmetic cleanup within the test framework that introduces assert_true and assert_false to slightly improve readability over assert_equal(..., True/False). Does not fix flakes, improve testing speed, or add new test coverage.
Membership: Adds assert_true() and assert_false() methods to test/functional/test_framework/util.py.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0
Reviewability: Ready
- Ready to review; changes are clean and CI is passing
The PR is clean, passes CI, and the scripted diff applies cleanly.
Author status: active
Resolved concerns:
- Initial implementation checked truthiness rather than strict boolean values, which the author resolved by switching to 'is not True' / 'is not False'.
Agreement: Neutral
- Neutral overall with no explicit approvals
- Resolved a correctness issue around strict boolean checking (l0rinc)
- Unconvinced the motivation warrants the change, but has no objection (maflcko)
Neutral; l0rinc's correctness comment on boolean typing was addressed, and maflcko is ~0 on the change
Nobody has explicitly ACKed or strongly endorsed the change. A correctness concern by l0rinc regarding truthiness was addressed by the author via force push, and maflcko expressed ~0 sentiment regarding the motivation.
- l0rinc noted the initial implementation asserted truthiness rather than boolean True/False
- hodlinator updated the helper to check 'is not' boolean identity
- maflcko stated 'No objection, but overall I am ~0 on this'
Review verdicts (DrahtBot): 0
Files
1148 lines under test/bench/ci.
- test/functional/wallet_migration.py +95/-93
- test/functional/rpc_psbt.py +40/-38
- test/functional/feature_proxy.py +25/-25
- test/functional/wallet_importdescriptors.py +23/-21
- test/functional/wallet_gethdkeys.py +19/-17
- test/functional/interface_ipc_mining.py +15/-13
- test/functional/wallet_signer.py +13/-11
- test/functional/p2p_addr_relay.py +12/-10
- test/functional/wallet_reorgsrestore.py +12/-10
- test/functional/feature_fee_estimation.py +11/-9
- test/functional/p2p_blocksonly.py +10/-10
- test/functional/wallet_exported_watchonly.py +11/-9
- test/functional/wallet_avoidreuse.py +10/-8
- test/functional/wallet_musig.py +10/-7
- test/functional/rpc_rawtransaction.py +9/-7
- test/functional/wallet_ancient_migration.py +9/-7
- test/functional/wallet_backwards_compatibility.py +9/-7
- test/functional/wallet_createwalletdescriptor.py +9/-7
- test/functional/wallet_importprunedfunds.py +9/-7
- test/functional/wallet_listtransactions.py +9/-7
- test/functional/wallet_keypool.py +8/-7
- test/functional/rpc_misc.py +8/-6
- test/functional/wallet_blank.py +7/-6
- test/functional/wallet_fundrawtransaction.py +7/-6
- test/functional/feature_assumeutxo.py +7/-5
- test/functional/interface_usdt_coinselection.py +7/-5
- test/functional/wallet_abandonconflict.py +7/-5
- test/functional/wallet_labels.py +6/-6
- test/functional/wallet_multiwallet.py +7/-5
- test/functional/rpc_blockchain.py +6/-5
- test/functional/test_framework/util.py +10/-1
- test/functional/wallet_descriptor.py +6/-4
- test/functional/wallet_listsinceblock.py +6/-4
- test/functional/wallet_miniscript.py +5/-5
- test/functional/wallet_transactiontime_rescan.py +6/-4
- test/functional/feature_notifications.py +5/-4
- test/functional/wallet_signrawtransactionwithwallet.py +5/-4
- test/functional/p2p_ibd_stalling.py +5/-3
- test/functional/rpc_net.py +5/-3
- test/functional/rpc_scantxoutset.py +4/-4
- test/functional/wallet_assumeutxo.py +5/-3
- test/functional/wallet_balance.py +5/-3
- test/functional/wallet_bumpfee.py +5/-3
- test/functional/wallet_orphanedreward.py +4/-4
- test/functional/wallet_send.py +5/-3
- test/functional/mempool_sigoplimit.py +4/-3
- test/functional/rpc_createmultisig.py +4/-3
- test/functional/wallet_createwallet.py +4/-3
- test/functional/feature_addrman.py +3/-3
- test/functional/feature_maxtipage.py +3/-3
- test/functional/interface_usdt_utxocache.py +4/-2
- test/functional/mempool_dust.py +4/-2
- test/functional/mempool_unbroadcast.py +4/-2
- test/functional/p2p_compactblocks_blocksonly.py +3/-3
- test/functional/p2p_tx_download.py +4/-2
- test/functional/rpc_scanblocks.py +4/-2
- test/functional/rpc_validateaddress.py +3/-3
- test/functional/wallet_basic.py +4/-2
- test/functional/wallet_disable.py +3/-3
- test/functional/wallet_txn_doublespend.py +4/-2
- test/functional/feature_minchainwork.py +3/-2
- test/functional/mining_template_verification.py +3/-2
- test/functional/wallet_address_types.py +3/-2
- test/functional/wallet_derivehdkey.py +3/-2
- test/functional/wallet_listreceivedby.py +3/-2
- test/functional/feature_discover.py +2/-2
- test/functional/p2p_compactblocks_hb.py +2/-2
- test/functional/rpc_openrpc.py +2/-2
- test/functional/wallet_deprecated_rbf.py +2/-2
- test/functional/feature_block.py +2/-1
- test/functional/feature_rbf.py +2/-1
- test/functional/interface_rest.py +2/-1
- test/functional/interface_usdt_mempool.py +2/-1
- test/functional/mempool_accept.py +2/-1
- test/functional/mempool_datacarrier.py +2/-1
- test/functional/p2p_disconnect_ban.py +2/-1
- test/functional/p2p_segwit.py +2/-1
- test/functional/p2p_sendheaders.py +2/-1
- test/functional/p2p_unrequested_blocks.py +2/-1
- test/functional/rpc_gettxspendingprevout.py +2/-1
- test/functional/rpc_signer.py +2/-1
- test/functional/rpc_signrawtransactionwithkey.py +2/-1
- test/functional/test_framework/test_framework.py +2/-1
- test/functional/test_framework/wallet.py +2/-1
- test/functional/tool_wallet.py +2/-1
- test/functional/wallet_anchor.py +2/-1
- test/functional/wallet_encryption.py +2/-1
- test/functional/wallet_hd.py +2/-1
- test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py +2/-1
- test/functional/wallet_resendwallettransactions.py +2/-1
- test/functional/wallet_sendall.py +2/-1
- test/functional/wallet_simulaterawtx.py +2/-1
- test/functional/wallet_txn_clone.py +2/-1
Card
This PR adds assert_true() and assert_false() helper functions to the functional test framework and converts existing assert_equal(..., True/False) checks across test files via scripted diff. It addresses developer ergonomics by simplifying boolean assertions in test suites. Importance is low as it is purely a cosmetic refactor without test coverage or bug fix impact. Review is ready, with no strong support and neutral sentiment from reviewers.