diff --git a/python/python/glide/async_commands/server_modules/json.py b/python/python/glide/async_commands/server_modules/json.py index 4149ce0127..93aaed9f2f 100644 --- a/python/python/glide/async_commands/server_modules/json.py +++ b/python/python/glide/async_commands/server_modules/json.py @@ -144,7 +144,7 @@ async def mget( keys: List[TEncodable], paths: Optional[Union[TEncodable, List[TEncodable]]] = None, options: Optional[JsonGetOptions] = None, -) -> Optional[List[bytes]]: +) -> List[Optional[bytes]]: """ Retrieves the JSON values at the specified `paths` stored at multiple `keys`. @@ -179,9 +179,7 @@ async def mget( paths = [paths] args.extend(paths) - results = await client.custom_command(args) - return [result if result is not None else None for result in results] - + return cast(List[Optional[bytes]], await client.custom_command(args)) async def arrlen( client: TGlideClient, diff --git a/python/python/tests/tests_server_modules/test_json.py b/python/python/tests/tests_server_modules/test_json.py index dca2890f6c..28ab32706c 100644 --- a/python/python/tests/tests_server_modules/test_json.py +++ b/python/python/tests/tests_server_modules/test_json.py @@ -229,8 +229,7 @@ async def test_json_mget(self, glide_client: TGlideClient): ["{non_existing_key}1", "{non_existing_key}2"], ["$a"], ) - expected_result = [None, None] - assert result == expected_result + assert result == [None, None] # Test with only one key result = await json.mget( @@ -255,8 +254,7 @@ async def test_json_mget(self, glide_client: TGlideClient): glide_client, [key1, key2], ) - expected_result = [None] - assert result == expected_result + assert result == [None] @pytest.mark.parametrize("cluster_mode", [True, False]) @pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])