mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 08:44:02 +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:
@@ -68,7 +68,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
|
||||
def check_node3_chaintips(num_tips, tip_hash, height):
|
||||
node3_chaintips = self.nodes[3].getchaintips()
|
||||
assert len(node3_chaintips) == num_tips
|
||||
assert_equal(len(node3_chaintips), num_tips)
|
||||
assert {
|
||||
'height': height,
|
||||
'hash': tip_hash,
|
||||
@@ -80,7 +80,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
|
||||
for node in self.nodes[1:3]:
|
||||
chaintips = node.getchaintips()
|
||||
assert len(chaintips) == 1
|
||||
assert_equal(len(chaintips), 1)
|
||||
assert {
|
||||
'height': 0,
|
||||
'hash': '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206',
|
||||
@@ -103,7 +103,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
'status': 'active',
|
||||
} in self.nodes[2].getchaintips()
|
||||
|
||||
assert len(self.nodes[2].getchaintips()) == 1
|
||||
assert_equal(len(self.nodes[2].getchaintips()), 1)
|
||||
|
||||
self.log.info("Check that node3 accepted these headers as well")
|
||||
check_node3_chaintips(2, self.nodes[0].getbestblockhash(), NODE1_BLOCKS_REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user