From 5a1bef60a03b57de708a1a751bd90b8245fd8b83 Mon Sep 17 00:00:00 2001 From: Zero-1729 Date: Wed, 4 Aug 2021 19:59:06 +0100 Subject: test: refactor: remove binascii from test_framework --- test/functional/interface_rest.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/functional/interface_rest.py') diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py index 0cd6a7b0c6..d644a420fc 100755 --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -4,7 +4,6 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the REST API.""" -import binascii from decimal import Decimal from enum import Enum from io import BytesIO @@ -235,13 +234,13 @@ class RESTTest (BitcoinTestFramework): response_hex = self.test_rest_request("/block/{}".format(bb_hash), req_type=ReqType.HEX, ret_type=RetType.OBJ) assert_greater_than(int(response_hex.getheader('content-length')), BLOCK_HEADER_SIZE*2) response_hex_bytes = response_hex.read().strip(b'\n') - assert_equal(binascii.hexlify(response_bytes), response_hex_bytes) + assert_equal(response_bytes.hex().encode(), response_hex_bytes) # Compare with hex block header response_header_hex = self.test_rest_request("/headers/1/{}".format(bb_hash), req_type=ReqType.HEX, ret_type=RetType.OBJ) assert_greater_than(int(response_header_hex.getheader('content-length')), BLOCK_HEADER_SIZE*2) response_header_hex_bytes = response_header_hex.read(BLOCK_HEADER_SIZE*2) - assert_equal(binascii.hexlify(response_bytes[:BLOCK_HEADER_SIZE]), response_header_hex_bytes) + assert_equal(response_bytes[:BLOCK_HEADER_SIZE].hex().encode(), response_header_hex_bytes) # Check json format block_json_obj = self.test_rest_request("/block/{}".format(bb_hash)) -- cgit v1.2.3