aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2017-12-12 14:55:00 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2017-12-13 14:51:46 +0000
commit27c6199373093bff194f996bca0a85ed52088790 (patch)
treef22cb04947fd5b086f41115487201a233e6471f5
parent320669a363b3674954a08c49541af65f42836b5d (diff)
test: Add multidict to support dictionary with duplicate key (laanwj)
-rwxr-xr-xtest/functional/rawtransactions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/rawtransactions.py b/test/functional/rawtransactions.py
index 79f2a2834e..1495bc3753 100755
--- a/test/functional/rawtransactions.py
+++ b/test/functional/rawtransactions.py
@@ -15,6 +15,25 @@ Test the following RPCs:
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
+
+class multidict(dict):
+ """Dictionary that allows duplicate keys.
+
+ Constructed with a list of (key, value) tuples. When dumped by the json module,
+ will output invalid json with repeated keys, eg:
+ >>> json.dumps(multidict([(1,2),(1,2)])
+ '{"1": 2, "1": 2}'
+
+ Used to test calls to rpc methods with repeated keys in the json object."""
+
+ def __init__(self, x):
+ dict.__init__(self, x)
+ self.x = x
+
+ def items(self):
+ return self.x
+
+
# Create one-input, one-output, no-fee transaction:
class RawTransactionsTest(BitcoinTestFramework):
def set_test_params(self):