mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +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:
@@ -111,7 +111,7 @@ class PSBT:
|
||||
self.tx = None
|
||||
|
||||
def deserialize(self, f):
|
||||
assert f.read(5) == b"psbt\xff"
|
||||
assert_equal(f.read(5), b"psbt\xff")
|
||||
self.g = from_binary(PSBTMap, f)
|
||||
assert PSBT_GLOBAL_UNSIGNED_TX in self.g.map
|
||||
self.tx = from_binary(CTransaction, self.g.map[PSBT_GLOBAL_UNSIGNED_TX])
|
||||
@@ -125,8 +125,8 @@ class PSBT:
|
||||
assert isinstance(self.o, list) and all(isinstance(x, PSBTMap) for x in self.o)
|
||||
assert PSBT_GLOBAL_UNSIGNED_TX in self.g.map
|
||||
tx = from_binary(CTransaction, self.g.map[PSBT_GLOBAL_UNSIGNED_TX])
|
||||
assert len(tx.vin) == len(self.i)
|
||||
assert len(tx.vout) == len(self.o)
|
||||
assert_equal(len(tx.vin), len(self.i))
|
||||
assert_equal(len(tx.vout), len(self.o))
|
||||
|
||||
psbt = [x.serialize() for x in [self.g] + self.i + self.o]
|
||||
return b"psbt\xff" + b"".join(psbt)
|
||||
|
||||
Reference in New Issue
Block a user