Rather than subsequently calling gettransaction and decoderawtransaction to get the decoded information for a specific tx-id, we can simply use the verbose version of gettransaction, which returns this in a 'decoded' key. I.e.
node.decoderawtransaction(node.gettransaction(txid)['hex'])
can simply be replaced by:
node.gettransaction(txid=txid, verbose=True)['decoded']
Rationale: shorter code, shorter test logs, less RPC calls.