Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 8, 2024
1 parent e6dd3a5 commit 2ab4007
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions tests/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,10 @@ def test_dict_refresh_update(client, request, znsclient):
def test_invalid_json(client, request):
c = request.getfixturevalue(client)
dct = znsocket.Dict(r=c, key="list:test")

with pytest.raises(ValueError, match="Invalid JSON"):
dct.update({"a": float("inf")})
with pytest.raises(ValueError, match="Invalid JSON"):
dct.update({"a": float("nan")})
with pytest.raises(ValueError, match="Invalid JSON"):
dct.update({"a": float("-inf")})


4 changes: 3 additions & 1 deletion znsocket/objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class ZnSocketObject:

def _encode(self, data: t.Any) -> str:
if self.converter is not None:
return json.dumps(data, cls=znjson.ZnEncoder.from_converters(self.converter), allow_nan=False)
return json.dumps(
data, cls=znjson.ZnEncoder.from_converters(self.converter), allow_nan=False
)
return json.dumps(data, allow_nan=False)


Expand Down

0 comments on commit 2ab4007

Please sign in to comment.