mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 01:04:43 +02:00
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:
@@ -100,12 +100,12 @@ def base58_to_byte(s):
|
||||
|
||||
|
||||
def keyhash_to_p2pkh(hash, main=False):
|
||||
assert len(hash) == 20
|
||||
assert_equal(len(hash), 20)
|
||||
version = 0 if main else 111
|
||||
return byte_to_base58(hash, version)
|
||||
|
||||
def scripthash_to_p2sh(hash, main=False):
|
||||
assert len(hash) == 20
|
||||
assert_equal(len(hash), 20)
|
||||
version = 5 if main else 196
|
||||
return byte_to_base58(hash, version)
|
||||
|
||||
@@ -144,7 +144,7 @@ def script_to_p2sh_p2wsh(script, main=False):
|
||||
return script_to_p2sh(p2shscript, main)
|
||||
|
||||
def output_key_to_p2tr(key, main=False):
|
||||
assert len(key) == 32
|
||||
assert_equal(len(key), 32)
|
||||
return program_to_witness(1, key, main)
|
||||
|
||||
def p2a(main=False):
|
||||
|
||||
Reference in New Issue
Block a user