diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 5dd62282ab..cabb2182cb 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -37,6 +37,13 @@ def set_timeout_scale(_timeout_scale): # Assert functions ################## +def assert_approx(v, vexp, vspan=0.00001): + """Assert that `v` is within `vspan` of `vexp`""" + if v < vexp - vspan: + raise AssertionError("%s < [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan))) + if v > vexp + vspan: + raise AssertionError("%s > [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan))) + def assert_fee_amount(fee, tx_size, fee_per_kB): """Assert the fee was in range""" target_fee = round(tx_size * fee_per_kB / 1000, 8) diff --git a/test/functional/wallet_groups.py b/test/functional/wallet_groups.py index 5452433acf..d1178611bd 100755 --- a/test/functional/wallet_groups.py +++ b/test/functional/wallet_groups.py @@ -7,15 +7,10 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import CTransaction, FromHex, ToHex from test_framework.util import ( + assert_approx, assert_equal, ) -def assert_approx(v, vexp, vspan=0.00001): - if v < vexp - vspan: - raise AssertionError("%s < [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan))) - if v > vexp + vspan: - raise AssertionError("%s > [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan))) - class WalletGroupTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True