Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with latest changes to redis-rs. #312

Merged
merged 2 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random
import string
from datetime import datetime, timedelta
from typing import Dict
from typing import Dict, List

import pytest
from packaging import version
Expand Down Expand Up @@ -42,7 +42,12 @@ async def async_socket_client(request, cluster_mode) -> RedisAsyncSocketClient:
client.close()


def parse_info_response(res: str) -> Dict[str, str]:
def to_str(res: str | List[str]) -> str:
return res[0] if isinstance(res, list) else res
Copy link
Collaborator

@barshaul barshaul Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res can also be None, and the function can return None.
change to str(res) if res else None



def parse_info_response(res: str | List[str]) -> Dict[str, str]:
res = to_str(res)
info_lines = [
line for line in res.splitlines() if line and not line.startswith("#")
]
Expand Down Expand Up @@ -170,8 +175,10 @@ async def test_custom_command_multi_arg(
self, async_socket_client: RedisAsyncSocketClient
):
# Test multi args command
res: str = await async_socket_client.custom_command(
["CLIENT", "LIST", "TYPE", "NORMAL"]
res: str = to_str(
await async_socket_client.custom_command(
["CLIENT", "LIST", "TYPE", "NORMAL"]
)
)
assert res is not None
assert "id" in res
Expand All @@ -182,8 +189,10 @@ async def test_custom_command_lower_and_upper_case(
self, async_socket_client: RedisAsyncSocketClient
):
# Test multi args command
res: str = await async_socket_client.custom_command(
["client", "LIST", "type", "NORMAL"]
res: str = to_str(
await async_socket_client.custom_command(
["client", "LIST", "type", "NORMAL"]
)
)
assert res is not None
assert "id" in res
Expand Down
Loading