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

+3 -2
View File
@@ -9,6 +9,7 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
assert_not_equal,
)
from test_framework.wallet_util import WalletUnlock
@@ -59,7 +60,7 @@ class WalletGetHDKeyTest(BitcoinTestFramework):
# New key is active, should be able to get only that one and its descriptors
xpub_info = wallet.gethdkeys(active_only=True)
assert_equal(len(xpub_info), 1)
assert xpub_info[0]["xpub"] != xpub
assert_not_equal(xpub_info[0]["xpub"], xpub)
assert "xprv" not in xpub_info[0]
assert_equal(xpub_info[0]["has_private"], True)
@@ -67,7 +68,7 @@ class WalletGetHDKeyTest(BitcoinTestFramework):
assert_raises_rpc_error(-13, "Error: Please enter the wallet passphrase with walletpassphrase first", wallet.gethdkeys, private=True)
with WalletUnlock(wallet, "pass"):
xpub_info = wallet.gethdkeys(active_only=True, private=True)[0]
assert xpub_info["xprv"] != xprv
assert_not_equal(xpub_info["xprv"], xprv)
for desc in wallet.listdescriptors(True)["descriptors"]:
if desc["active"]:
# After encrypting, HD key was rotated and should appear in all active descriptors