diff options
author | fanquake <fanquake@gmail.com> | 2019-12-09 15:02:50 -0500 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-12-09 15:14:20 -0500 |
commit | b6f9e3576a1ea18572e4803aeb3f39330f0cb759 (patch) | |
tree | a37a8044b58bd02b1609d7ef86b36bfbe5740980 /test/functional/test_framework/util.py | |
parent | 347dd76ec87ddbd1913dc7b57729793ac3bb1ab9 (diff) |
test: re-enable CLI test support by using EncodeDecimal in json.dumps()
As mentioned in
https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
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)) |