summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorshacharPash <93581407+shacharPash@users.noreply.github.com>2023-04-30 14:57:27 +0300
committerGitHub <noreply@github.com>2023-04-30 14:57:27 +0300
commitbf528fc7f776ce8e926b2e9abfa4e2460d73baa4 (patch)
treedf3c61e3fcc8d31d4a1d5ea598ad4d01e67dd7e5 /tests/test_commands.py
parent8b58ebb73e03970fade4d3f9e2c961831713c228 (diff)
downloadredis-py-bf528fc7f776ce8e926b2e9abfa4e2460d73baa4.tar.gz
Add WITHSCORES to ZREVRANK Command (#2725)
* add withscores to zrevrank * change 0 -> 2 * fix errors * split test
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index a44dac4..2b769be 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -2641,6 +2641,15 @@ class TestRedisCommands:
assert r.zrevrank("a", "a2") == 3
assert r.zrevrank("a", "a6") is None
+ @skip_if_server_version_lt("7.2.0")
+ def test_zrevrank_withscore(self, r):
+ r.zadd("a", {"a1": 1, "a2": 2, "a3": 3, "a4": 4, "a5": 5})
+ assert r.zrevrank("a", "a1") == 4
+ assert r.zrevrank("a", "a2") == 3
+ assert r.zrevrank("a", "a6") is None
+ assert r.zrevrank("a", "a3", withscore=True) == [2, "3"]
+ assert r.zrevrank("a", "a6", withscore=True) is None
+
def test_zscore(self, r):
r.zadd("a", {"a1": 1, "a2": 2, "a3": 3})
assert r.zscore("a", "a1") == 1.0