diff options
author | fanquake <fanquake@gmail.com> | 2019-12-11 20:10:59 -0500 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-12-11 20:33:28 -0500 |
commit | 3f1966ead6b2324d863ae6c5d9956cf4b9e4b148 (patch) | |
tree | 3dcd7aa290a0c65caacb8ec3500531e0216b4cda /test/functional/test_framework/util.py | |
parent | 5948398b1866f94bdd19c6791b9b319bdee8b32e (diff) | |
parent | b6f9e3576a1ea18572e4803aeb3f39330f0cb759 (diff) |
Merge #17705: test: re-enable CLI test support by using EncodeDecimal in json.dumps()
b6f9e3576a1ea18572e4803aeb3f39330f0cb759 test: re-enable CLI test support by using EncodeDecimal in json.dumps() (fanquake)
Pull request description:
As mentioned in https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648.
ACKs for top commit:
practicalswift:
ACK b6f9e3576a1ea18572e4803aeb3f39330f0cb759 assuming Travis is happy too -- diff looks correct :)
MarcoFalke:
> ACK b6f9e35 assuming Travis is happy too -- diff looks correct :)
Tree-SHA512: 79fa535cc1756c8ee610a3d6a316a1c4f036797d6990a5620e44985393a2e52f78450f8e0021d0a148c08705fd1ba765508464a365f9030ae0d2cacbd7a93e19
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r-- | test/functional/test_framework/util.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 4d7967273a..5bb73aee7e 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -190,6 +190,11 @@ def check_json_precision(): if satoshis != 2000000000000003: raise RuntimeError("JSON encode/decode loses precision") +def EncodeDecimal(o): + if isinstance(o, Decimal): + return str(o) + raise TypeError(repr(o) + " is not JSON serializable") + def count_bytes(hex_string): return len(bytearray.fromhex(hex_string)) |