File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 25
25
# Assert functions
26
26
##################
27
27
28
+ def assert_approx (v , vexp , vspan = 0.00001 ):
29
+ """Assert that `v` is within `vspan` of `vexp`"""
30
+ if v < vexp - vspan :
31
+ raise AssertionError ("%s < [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
32
+ if v > vexp + vspan :
33
+ raise AssertionError ("%s > [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
34
+
28
35
def assert_fee_amount (fee , tx_size , fee_per_kB ):
29
36
"""Assert the fee was in range"""
30
37
target_fee = round (tx_size * fee_per_kB / 1000 , 8 )
Original file line number Diff line number Diff line change 6
6
7
7
from test_framework .test_framework import BitcoinTestFramework
8
8
from test_framework .util import (
9
+ assert_approx ,
9
10
assert_equal ,
10
11
assert_raises_rpc_error ,
11
12
connect_nodes ,
12
13
)
13
14
14
- # TODO: Copied from wallet_groups.py -- should perhaps move into util.py
15
- def assert_approx (v , vexp , vspan = 0.00001 ):
16
- if v < vexp - vspan :
17
- raise AssertionError ("%s < [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
18
- if v > vexp + vspan :
19
- raise AssertionError ("%s > [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
20
-
21
15
def reset_balance (node , discardaddr ):
22
16
'''Throw away all owned coins by the node so it gets a balance of 0.'''
23
17
balance = node .getbalance (avoid_reuse = False )
Original file line number Diff line number Diff line change 7
7
from test_framework .test_framework import BitcoinTestFramework
8
8
from test_framework .messages import CTransaction , FromHex , ToHex
9
9
from test_framework .util import (
10
+ assert_approx ,
10
11
assert_equal ,
11
12
)
12
13
13
- def assert_approx (v , vexp , vspan = 0.00001 ):
14
- if v < vexp - vspan :
15
- raise AssertionError ("%s < [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
16
- if v > vexp + vspan :
17
- raise AssertionError ("%s > [%s..%s]" % (str (v ), str (vexp - vspan ), str (vexp + vspan )))
18
-
19
14
class WalletGroupTest (BitcoinTestFramework ):
20
15
def set_test_params (self ):
21
16
self .setup_clean_chain = True
You can’t perform that action at this time.
0 commit comments