Skip to content

Commit

Permalink
Merge pull request jupyter#5174 from tirkarthi/fix-json-loads-encoding
Browse files Browse the repository at this point in the history
Remove deprecated encoding parameter for Python 3.9 compatibility.
  • Loading branch information
minrk authored Jan 23, 2020
2 parents 8a67477 + c01b2cc commit 43df5af
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions notebook/tests/test_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_gateway_get_kernelspecs(self):
with mocked_gateway:
response = self.request('GET', '/api/kernelspecs')
self.assertEqual(response.status_code, 200)
content = json.loads(response.content.decode('utf-8'), encoding='utf-8')
content = json.loads(response.content.decode('utf-8'))
kspecs = content.get('kernelspecs')
self.assertEqual(len(kspecs), 2)
self.assertEqual(kspecs.get('kspec_bar').get('name'), 'kspec_bar')
Expand All @@ -186,7 +186,7 @@ def test_gateway_get_named_kernelspec(self):
with mocked_gateway:
response = self.request('GET', '/api/kernelspecs/kspec_foo')
self.assertEqual(response.status_code, 200)
kspec_foo = json.loads(response.content.decode('utf-8'), encoding='utf-8')
kspec_foo = json.loads(response.content.decode('utf-8'))
self.assertEqual(kspec_foo.get('name'), 'kspec_foo')

response = self.request('GET', '/api/kernelspecs/no_such_spec')
Expand Down Expand Up @@ -257,7 +257,7 @@ def create_session(self, kernel_name):
# Create the kernel... (also tests get_kernel)
response = self.request('POST', '/api/sessions', **kwargs)
self.assertEqual(response.status_code, 201)
model = json.loads(response.content.decode('utf-8'), encoding='utf-8')
model = json.loads(response.content.decode('utf-8'))
self.assertEqual(model.get('path'), nb_path)
kernel_id = model.get('kernel').get('id')
# ensure its in the running_kernels and name matches.
Expand Down Expand Up @@ -286,7 +286,7 @@ def is_kernel_running(self, kernel_id):
# Get list of running kernels
response = self.request('GET', '/api/kernels')
self.assertEqual(response.status_code, 200)
kernels = json.loads(response.content.decode('utf-8'), encoding='utf-8')
kernels = json.loads(response.content.decode('utf-8'))
self.assertEqual(len(kernels), len(running_kernels))
for model in kernels:
if model.get('id') == kernel_id:
Expand All @@ -305,7 +305,7 @@ def create_kernel(self, kernel_name):

response = self.request('POST', '/api/kernels', **kwargs)
self.assertEqual(response.status_code, 201)
model = json.loads(response.content.decode('utf-8'), encoding='utf-8')
model = json.loads(response.content.decode('utf-8'))
kernel_id = model.get('id')
# ensure its in the running_kernels and name matches.
running_kernel = running_kernels.get(kernel_id)
Expand All @@ -330,7 +330,7 @@ def restart_kernel(self, kernel_id):
with mocked_gateway:
response = self.request('POST', '/api/kernels/' + kernel_id + '/restart')
self.assertEqual(response.status_code, 200)
model = json.loads(response.content.decode('utf-8'), encoding='utf-8')
model = json.loads(response.content.decode('utf-8'))
restarted_kernel_id = model.get('id')
# ensure its in the running_kernels and name matches.
running_kernel = running_kernels.get(restarted_kernel_id)
Expand All @@ -345,4 +345,3 @@ def delete_kernel(self, kernel_id):
response = self.request('DELETE', '/api/kernels/' + kernel_id)
self.assertEqual(response.status_code, 204)
self.assertEqual(response.reason, 'No Content')

0 comments on commit 43df5af

Please sign in to comment.