From 4a335eeb612379e88b1599b9fa85fcadc6ca2231 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 9 Oct 2018 12:39:09 +0100 Subject: [PATCH] [Tests] json loads Python 3.5 compatible json.loads in Python 3.6 accepts str or bytes but Python 3.5 is str only so decode. --- deluge/tests/test_json_api.py | 4 ++-- deluge/tests/test_webserver.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deluge/tests/test_json_api.py b/deluge/tests/test_json_api.py index 546d57fc3..8c6d34bdb 100644 --- a/deluge/tests/test_json_api.py +++ b/deluge/tests/test_json_api.py @@ -86,7 +86,7 @@ class JSONTestCase(JSONBase): def write(response_str): request.write_was_called = True - response = json_lib.loads(response_str) + response = json_lib.loads(response_str.decode()) self.assertEqual(response['result'], None) self.assertEqual(response['id'], None) self.assertEqual( @@ -271,7 +271,7 @@ class JSONRequestFailedTestCase(JSONBase, WebServerMockBase): def write(response_str): request.write_was_called = True - response = json_lib.loads(response_str) + response = json_lib.loads(response_str.decode()) self.assertEqual(response['result'], None, 'BAD RESULT') self.assertEqual(response['id'], 0) self.assertEqual( diff --git a/deluge/tests/test_webserver.py b/deluge/tests/test_webserver.py index abfac366e..e0986e475 100644 --- a/deluge/tests/test_webserver.py +++ b/deluge/tests/test_webserver.py @@ -55,6 +55,6 @@ class WebServerTestCase(WebServerTestBase, WebServerMockBase): body = yield twisted.web.client.readBody(d) - json = json_lib.loads(body) + json = json_lib.loads(body.decode()) self.assertEqual(None, json['error']) self.assertEqual('torrent_filehash', json['result']['name'])