Skip to content

Commit

Permalink
fix python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shachlanAmazon committed Jul 12, 2023
1 parent a12f2e8 commit 9136227
Showing 1 changed file with 15 additions and 6 deletions.
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


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

0 comments on commit 9136227

Please sign in to comment.