tests: Add data-driven testcases to rpc_decodescript.py #23672

pull Kvaciral wants to merge 1 commits into bitcoin:master from Kvaciral:functest_rpcdecodescript changing 2 files +133 −0
  1. Kvaciral commented at 3:37 PM on December 4, 2021: contributor

    closes #23641

  2. laanwj added the label Tests on Dec 4, 2021
  3. jamesob commented at 4:13 PM on December 4, 2021: member

    Nice, concept ACK

  4. brunoerg commented at 7:44 PM on December 4, 2021: member

    Concept ACK

  5. brunoerg approved
  6. brunoerg commented at 8:00 PM on December 4, 2021: member

    tACK f7ddfef9371f476533ddbbc1cf0c8520c01f8e42

  7. alirezaayande approved
  8. in test/functional/rpc_decodescript.py:262 in f7ddfef937 outdated
     254 | @@ -252,13 +255,23 @@ def decoderawtransaction_asm_sighashtype(self):
     255 |          rpc_result = self.nodes[0].decoderawtransaction(txSave.serialize().hex())
     256 |          assert_equal('OP_RETURN 3011020701010101010101020601010101010101', rpc_result['vin'][0]['scriptSig']['asm'])
     257 |  
     258 | +    def decodescript_datadriven_tests(self):
     259 | +        with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data/rpc_decodescript.json'), encoding='utf-8') as f:
     260 | +            dd_tests = json.load(f)
     261 | +
     262 | +        for dd_test in dd_tests:
    


    MarcoFalke commented at 8:42 AM on December 5, 2021:

    nit: If you make dd_tests a dictionary of the form { 'input1': { ... rpc result ... }, 'input2': {...}, ...}, you can avoid the array indices.

            for script, result in dd_tests:
    

    laanwj commented at 3:50 PM on December 5, 2021:

    I think that should work if you don't change the data type? , would unpack the arrays. When converting to a dictionary you'd need to iterate over dd_tests.items().

  9. MarcoFalke approved
  10. MarcoFalke commented at 8:43 AM on December 5, 2021: member

    Thanks, ACK

  11. tests: Add data-driven testcases to rpc_decodescript.py b35942e500
  12. MarcoFalke merged this on Dec 6, 2021
  13. MarcoFalke closed this on Dec 6, 2021

  14. sidhujag referenced this in commit 20b6b60d94 on Dec 6, 2021
  15. RandyMcMillan referenced this in commit 4b6a6838b3 on Dec 23, 2021
  16. DrahtBot locked this on Dec 6, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-28 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me