MCPcopy Create free account
hub / github.com/ElementsProject/elements / assert_approx

Function assert_approx

test/functional/test_framework/util.py:41–46  ·  view source on GitHub ↗

Assert that `v` is within `vspan` of `vexp`

(v, vexp, vspan=0.00001)

Source from the content-addressed store, hash-verified

39
40
41def assert_approx(v, vexp, vspan=0.00001):
42 """Assert that `v` is within `vspan` of `vexp`"""
43 if v < vexp - vspan:
44 raise AssertionError("%s < [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan)))
45 if v > vexp + vspan:
46 raise AssertionError("%s > [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan)))
47
48
49def assert_fee_amount(fee, tx_size, feerate_BTC_kvB):

Callers 10

test_option_feerateMethod · 0.90
test_getpeerinfoMethod · 0.90
run_testMethod · 0.90
assert_unspentFunction · 0.90
assert_balancesFunction · 0.90
run_testMethod · 0.90
_check_psbtMethod · 0.90
run_testMethod · 0.90

Calls

no outgoing calls