test: replace bare asserts with assertion helpers in rpc_blockchain.py #34738

pull Bortlesboat wants to merge 1 commits into bitcoin:master from Bortlesboat:test-replace-bare-asserts-rpc-blockchain changing 1 files +8 −6
  1. Bortlesboat commented at 2:00 AM on March 5, 2026: none

    Replace 6 bare assert statements in test/functional/rpc_blockchain.py with test framework assertion helpers (assert_greater_than, assert_greater_than_or_equal, assert_approx).

    Bare asserts produce unhelpful AssertionError with no context on failure. The test framework helpers print the actual vs expected values, making debugging much easier.

    Changes:

    • assert height >= 144 and height <= 287 → two assert_greater_than_or_equal calls
    • assert size > 6400 / assert size < 64000assert_greater_than calls
    • Two assert abs(x - 1) < 0.0001 patterns → assert_approx(x, 1, vspan=0.0001)
    • assert hashes_per_second > 0.003assert_greater_than
    • Added assert_approx to the existing import block

    Each replacement preserves the exact same logical condition.

    Part of #23119.

  2. test: replace bare asserts with assertion helpers in rpc_blockchain.py
    Replace 6 bare assert statements with test framework assertion helpers
    (assert_greater_than, assert_greater_than_or_equal, assert_approx) to
    produce more informative error messages on failure.
    
    Part of #23119.
    bc769e1a47
  3. DrahtBot added the label Tests on Mar 5, 2026
  4. DrahtBot commented at 2:01 AM on March 5, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko commented at 6:30 AM on March 5, 2026: member

    lgtm ACK bc769e1a4771f8e6a6959cf8e7f07698c5b07826

  6. Bortlesboat closed this on Mar 6, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me