summaryrefslogtreecommitdiff
path: root/tests/test_scripting.py
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-02-02 13:26:00 +0200
committerGitHub <noreply@github.com>2022-02-02 13:26:00 +0200
commit7f7f4f6c85c2d05e1810b512890ec42f64ffa0b3 (patch)
treee8e0c287c3ba42a4ddb56ccd65e8f19162b7af23 /tests/test_scripting.py
parent58b28e43410b8e6e554de8f082f83a5835b075a6 (diff)
downloadredis-py-7f7f4f6c85c2d05e1810b512890ec42f64ffa0b3.tar.gz
Add support for EVALSHA_RO (#1863)
* add evalsha-ro * fix pr comment * add type hints * add type hints
Diffstat (limited to 'tests/test_scripting.py')
-rw-r--r--tests/test_scripting.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_scripting.py b/tests/test_scripting.py
index b0d76c7..f4671a5 100644
--- a/tests/test_scripting.py
+++ b/tests/test_scripting.py
@@ -74,6 +74,15 @@ class TestScripting:
# 2 * 3 == 6
assert r.evalsha(sha, 1, "a", 3) == 6
+ # @skip_if_server_version_lt("7.0.0") turn on after redis 7 release
+ def test_evalsha_ro(self, unstable_r):
+ unstable_r.set("a", "b")
+ get_sha = unstable_r.script_load("return redis.call('GET', KEYS[1])")
+ del_sha = unstable_r.script_load("return redis.call('DEL', KEYS[1])")
+ assert unstable_r.evalsha_ro(get_sha, 1, "a") == b"b"
+ with pytest.raises(redis.ResponseError):
+ unstable_r.evalsha_ro(del_sha, 1, "a")
+
def test_evalsha_script_not_loaded(self, r):
r.set("a", 2)
sha = r.script_load(multiply_script)