MCPcopy
hub / github.com/petertodd/python-bitcoinlib / load_test_vectors

Function load_test_vectors

bitcoin/tests/test_checkblock.py:19–35  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

17from bitcoin.core import *
18
19def load_test_vectors(name):
20 with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd:
21 for test_case in json.load(fd):
22 # Comments designated by single length strings
23 if len(test_case) == 1:
24 continue
25 assert len(test_case) == 5
26
27 (comment, fHeader, fCheckPoW, cur_time, serialized_blk) = test_case
28
29 blk = None
30 if fHeader:
31 blk = CBlockHeader.deserialize(x(serialized_blk))
32 else:
33 blk = CBlock.deserialize(x(serialized_blk))
34
35 yield (comment, fHeader, fCheckPoW, cur_time, blk)
36
37
38class Test_CheckBlock(unittest.TestCase):

Callers 2

test_checkblock_validMethod · 0.70

Calls 2

xFunction · 0.85
deserializeMethod · 0.45

Tested by

no test coverage detected