Skip to content

Commit

Permalink
Fix minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
davidotte committed Mar 11, 2024
1 parent bce902d commit 85a10a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tabpfn_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from importlib.metadata import version, PackageNotFoundError
import numpy as np
from omegaconf import OmegaConf
import json

from tabpfn_client.tabpfn_common_utils import utils as common_utils

Expand Down Expand Up @@ -136,8 +137,8 @@ def _validate_response(response, method_name, only_version_check=False):
load = None
try:
load = response.json()
except Exception:
pass
except json.JSONDecodeError as e:
logging.error(f"Failed to parse JSON from response in {method_name}: {e}")

# Check if the server requires a newer client version.
if response.status_code == 426:
Expand Down
2 changes: 1 addition & 1 deletion tabpfn_client/tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_try_connection_with_invalid_server(self, mock_server):
self.assertFalse(self.client.try_connection())

@with_mock_server()
def test_try_connection_with_outdated_client(self, mock_server):
def test_try_connection_with_outdated_client_raises_runtime_error(self, mock_server):
mock_server.router.get(mock_server.endpoints.root.path).respond(
426, json={"detail": "Client version too old. ..."})
with self.assertRaises(RuntimeError) as cm:
Expand Down

0 comments on commit 85a10a8

Please sign in to comment.