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

+7 -6
View File
@@ -12,6 +12,7 @@ from test_framework.p2p import (
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_not_equal,
assert_equal,
p2p_port,
)
@@ -82,9 +83,9 @@ class AddrTest(BitcoinTestFramework):
if i > 0:
# Responses from different binds should be unique
assert last_response_on_local_bind != addr_receiver_onion1.get_received_addrs()
assert last_response_on_local_bind != addr_receiver_onion2.get_received_addrs()
assert last_response_on_onion_bind1 != addr_receiver_onion2.get_received_addrs()
assert_not_equal(last_response_on_local_bind, addr_receiver_onion1.get_received_addrs())
assert_not_equal(last_response_on_local_bind, addr_receiver_onion2.get_received_addrs())
assert_not_equal(last_response_on_onion_bind1, addr_receiver_onion2.get_received_addrs())
# Responses on from the same bind should be the same
assert_equal(last_response_on_local_bind, addr_receiver_local.get_received_addrs())
assert_equal(last_response_on_onion_bind1, addr_receiver_onion1.get_received_addrs())
@@ -113,9 +114,9 @@ class AddrTest(BitcoinTestFramework):
addr_receiver_onion2.wait_until(addr_receiver_onion2.addr_received)
# new response is different
assert set(last_response_on_local_bind) != set(addr_receiver_local.get_received_addrs())
assert set(last_response_on_onion_bind1) != set(addr_receiver_onion1.get_received_addrs())
assert set(last_response_on_onion_bind2) != set(addr_receiver_onion2.get_received_addrs())
assert_not_equal(set(last_response_on_local_bind), set(addr_receiver_local.get_received_addrs()))
assert_not_equal(set(last_response_on_onion_bind1), set(addr_receiver_onion1.get_received_addrs()))
assert_not_equal(set(last_response_on_onion_bind2), set(addr_receiver_onion2.get_received_addrs()))
if __name__ == '__main__':