Permalink
Browse files

[tests] clarify assertions in getblocktemplate test

  • Loading branch information...
1 parent 66c570a commit f82c709fbe9d1e7ae646a6d3b536971b411c906d @jnewbery jnewbery committed Apr 11, 2017
Showing with 3 additions and 5 deletions.
  1. +3 −5 test/functional/getblocktemplate_proposals.py
@@ -64,8 +64,7 @@ def template_to_hex(tmpl, txlist):
def assert_template(node, tmpl, txlist, expect):
rsp = node.getblocktemplate({'data': template_to_hex(tmpl, txlist), 'mode': 'proposal'})
- if rsp != expect:
- raise AssertionError('unexpected: %s' % (rsp,))
+ assert_equal(rsp, expect)
class GetBlockTemplateProposalTest(BitcoinTestFramework):
@@ -88,7 +87,7 @@ def run_test(self):
txlist = [bytearray(coinbase_tx.serialize())]
self.log.info("getblocktemplate: Test capability advertised")
- assert('proposal' in tmpl['capabilities'])
+ assert 'proposal' in tmpl['capabilities']
self.log.info("getblocktemplate: Test bad input hash for coinbase transaction")
txlist[0][4 + 1] += 1
@@ -131,8 +130,7 @@ def run_test(self):
rawtmpl = template_to_bytearray(tmpl, txlist)
rawtmpl[4 + 32] = (rawtmpl[4 + 32] + 1) % 0x100
rsp = node.getblocktemplate({'data': b2x(rawtmpl), 'mode': 'proposal'})
- if rsp != 'bad-txnmrklroot':
- raise AssertionError('unexpected: %s' % (rsp,))
+ assert_equal(rsp, 'bad-txnmrklroot')
self.log.info("getblocktemplate: Test bad timestamps")
realtime = tmpl['curtime']

0 comments on commit f82c709

Please sign in to comment.