summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorShay Fadida <shayfadida@gmail.com>2022-11-09 14:22:27 +0200
committerGitHub <noreply@github.com>2022-11-09 14:22:27 +0200
commitfb647430f00cc7bb67c978e75f2dabc661567779 (patch)
tree009cd0ab1bde4d4bcbaab5711079c04aab0eda74 /tests/test_commands.py
parent772079fabd7453edf3788d0c31b9caf21ff5deca (diff)
downloadredis-py-fb647430f00cc7bb67c978e75f2dabc661567779.tar.gz
Fix special response parsing options handling (#2302)
* Fix special response parsing options handling When using special response parsing options like `NEVER_DECODE` and `EMPTY_RESPONSE`, don't pass them to the response callbacks because some of them are not prepared for receiving named arguments. Instead, redis-py should use them before calling the callbacks and then discard them. * Use kwargs instead of options * change options to kwargs in asyncio/cluster.py/L878 Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 1c9a5c2..aa6745b 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -9,7 +9,7 @@ import pytest
import redis
from redis import exceptions
-from redis.client import parse_info
+from redis.client import EMPTY_RESPONSE, NEVER_DECODE, parse_info
from .conftest import (
_get_client,
@@ -917,6 +917,16 @@ class TestRedisCommands:
time.sleep(0.3)
assert r.bgsave(True)
+ def test_never_decode_option(self, r: redis.Redis):
+ opts = {NEVER_DECODE: []}
+ r.delete("a")
+ assert r.execute_command("EXISTS", "a", **opts) == 0
+
+ def test_empty_response_option(self, r: redis.Redis):
+ opts = {EMPTY_RESPONSE: []}
+ r.delete("a")
+ assert r.execute_command("EXISTS", "a", **opts) == 0
+
# BASIC KEY COMMANDS
def test_append(self, r):
assert r.append("a", "a1") == 2