scripted-diff: replace remaining Python test equality asserts

Some Python functional tests still use plain `assert x == y`.
The earlier commits convert the ambiguous assert patterns by hand, so this commit can rewrite the remaining safe cases mechanically.
The verify script excludes `wallet_bumpfee.py`, `test_framework/netutil.py`, and `test_framework/authproxy.py`, which still contain assert forms that the plain line-based substitution would misidentify.

-BEGIN VERIFY SCRIPT-
perl -pi -e 's/^(\s*)assert (.+?) == ([^,#]+?)$/\1assert_equal(\2, \3)/' $(git ls-files -- 'test/functional' \
':(exclude)test/functional/wallet_bumpfee.py' ':(exclude)test/functional/test_framework/netutil.py' ':(exclude)test/functional/test_framework/authproxy.py')
-END VERIFY SCRIPT-
This commit is contained in:
Lőrinc
2026-03-08 21:31:30 +00:00
parent 301b1d7b1f
commit 3fd68a95e6
37 changed files with 113 additions and 113 deletions

View File

@@ -109,7 +109,7 @@ class CScriptOp(int):
try:
return _opcode_instances[n]
except IndexError:
assert len(_opcode_instances) == n
assert_equal(len(_opcode_instances), n)
_opcode_instances.append(super().__new__(cls, n))
return _opcode_instances[n]
@@ -854,7 +854,7 @@ def TaprootSignatureMsg(txTo, spent_utxos, hash_type, input_index=0, *, scriptpa
ss += TaggedHash("TapLeaf", bytes([leaf_ver]) + ser_string(leaf_script))
ss += bytes([0])
ss += codeseparator_pos.to_bytes(4, "little", signed=False)
assert len(ss) == 175 - (in_type == SIGHASH_ANYONECANPAY) * 49 - (out_type != SIGHASH_ALL and out_type != SIGHASH_SINGLE) * 32 + (annex is not None) * 32 + scriptpath * 37
assert_equal(len(ss), 175 - (in_type == SIGHASH_ANYONECANPAY) * 49 - (out_type != SIGHASH_ALL and out_type != SIGHASH_SINGLE) * 32 + (annex is not None) * 32 + scriptpath * 37)
return ss
def TaprootSignatureHash(*args, **kwargs):
@@ -875,7 +875,7 @@ def taproot_tree_helper(scripts):
code = script[1]
if len(script) == 3:
version = script[2]
assert version & 1 == 0
assert_equal(version & 1, 0)
assert isinstance(code, bytes)
h = TaggedHash("TapLeaf", bytes([version]) + ser_string(code))
if name is None: