test: create assert_not_equal util and add to where imports are needed

In the functional tests there are lots of cases where we assert != which
this new util will replace, we also are adding the imports and the new assertion
This commit is contained in:
kevkevin authored and kevkevinpal committed 2025-04-01 08:39:24 -04:00
1 parent 930b237f16
commit 7bb83f6718
41 files changed
+137 -83

No files matched your search

+5 -4
View File
@@ -28,6 +28,7 @@ from test_framework.p2p import (
TXID_RELAY_DELAY,
)
from test_framework.util import (
assert_not_equal,
assert_equal,
)
from test_framework.test_framework import BitcoinTestFramework
@@ -116,7 +117,7 @@ class PeerTxRelayer(P2PTxInvStore):
self.sync_with_ping()
for getdata in self.getdata_received:
for request in getdata.inv:
assert request.hash != txhash
assert_not_equal(request.hash, txhash)
class OrphanHandlingTest(BitcoinTestFramework):
def set_test_params(self):
@@ -149,7 +150,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
tx_bad_wit.wit.vtxinwit[0].scriptWitness.stack = [b'garbage']
assert_equal(tx["txid"], tx_bad_wit.rehash())
assert tx["wtxid"] != tx_bad_wit.getwtxid()
assert_not_equal(tx["wtxid"], tx_bad_wit.getwtxid())
return tx_bad_wit
@@ -410,8 +411,8 @@ class OrphanHandlingTest(BitcoinTestFramework):
assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].getwtxid())
child = self.wallet.create_self_transfer(utxo_to_spend=parent_low_fee_nonsegwit["new_utxo"])
grandchild = self.wallet.create_self_transfer(utxo_to_spend=child["new_utxo"])
assert child["txid"] != child["tx"].getwtxid()
assert grandchild["txid"] != grandchild["tx"].getwtxid()
assert_not_equal(child["txid"], child["tx"].getwtxid())
assert_not_equal(grandchild["txid"], grandchild["tx"].getwtxid())
# Relay the parent. It should be rejected because it pays 0 fees.
self.relay_transaction(peer1, parent_low_fee_nonsegwit["tx"])