Skip to content

Commit

Permalink
changes from CR
Browse files Browse the repository at this point in the history
  • Loading branch information
pdyba committed Jan 31, 2024
1 parent 628f0e6 commit 00bb010
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
4 changes: 1 addition & 3 deletions lbz/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def to_dict(self) -> dict:

def json(self) -> dict:
if self._json is None:
if not isinstance(self.body, str):
raise ValueError(f"Got unexpected type to decode {type(self.body)}")
self._json = json.loads(self.body)
self._json = json.loads(self.body) # type: ignore[arg-type]
return self._json

@deprecated(message="Use the ok property instead", version="0.7.0")
Expand Down
7 changes: 0 additions & 7 deletions tests/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ def test__json__returns_dict_based_on_declared_body(self, body: Any) -> None:

assert response.json() == {"message": "It is alive!"}

def test__json__raises_value_error_when_body_is_not_a_string(self) -> None:
response = Response("")
response.body = [] # type: ignore

with pytest.raises(ValueError, match="Got unexpected type to decode <class 'list'>"):
assert response.json()

@pytest.mark.parametrize(
"body, headers, is_json",
[
Expand Down

0 comments on commit 00bb010

Please sign in to comment.