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 6, 2024
1 parent 8cb023e commit d89ff36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def test_hgetall(client, request):

assert pipeline.execute() == [{"bar": "baz", "lorem": "ipsum"}]


@pytest.mark.parametrize("client", ["znsclient", "znsclient_w_redis", "redisclient"])
def test_set_none(client, request):
c = request.getfixturevalue(client)
Expand All @@ -189,13 +190,16 @@ def test_set_none(client, request):
# while znsocket only stops operations AFTER the failed operation
# assert c.get("foo") is None # REDIS
# assert c.get("foo") == "bar" # ZNSOCKET



@pytest.mark.parametrize("client", ["znsclient", "znsclient_w_redis"])
def test_set_large_message(client, request, caplog):
c = request.getfixturevalue(client)
pipeline = c.pipeline(max_message_size=3000)
for _ in range(100):
pipeline.set("foo", "bar")

with pytest.warns(UserWarning): # assert that the messae is too large and is being split
with pytest.warns(
UserWarning
): # assert that the messae is too large and is being split
assert pipeline.execute() == [True] * 100
5 changes: 4 additions & 1 deletion znsocket/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ def _send_message(message) -> list:
_handle_error(result)

# Process and return results with list comprehension
return [set(res["data"]) if res.get("type") == "set" else res["data"] for res in result["data"]]
return [
set(res["data"]) if res.get("type") == "set" else res["data"]
for res in result["data"]
]

message = []
results = []
Expand Down

0 comments on commit d89ff36

Please sign in to comment.