summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorAvital Fine <98389525+Avital-Fine@users.noreply.github.com>2022-05-16 08:55:55 +0300
committerGitHub <noreply@github.com>2022-05-16 08:55:55 +0300
commita53bc0ca01211e5e14a468077a9d1974dbba6054 (patch)
tree62b7d5aa0680c16f59fe813dde6b8939f927fb9c /tests/test_commands.py
parent42b937fa1f73f3e8251eba5ec8ead2fcbaec7c50 (diff)
downloadredis-py-a53bc0ca01211e5e14a468077a9d1974dbba6054.tar.gz
fix incorrect test (#2177)
* fix incorrect test * Fix types
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index d5ab4e3..a3972a5 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -2215,20 +2215,21 @@ class TestRedisCommands:
@skip_if_server_version_lt("6.2.0")
def test_zadd_gt_lt(self, r):
+ r.zadd("a", {"a": 2})
+ assert r.zadd("a", {"a": 5}, gt=True, ch=True) == 1
+ assert r.zadd("a", {"a": 1}, gt=True, ch=True) == 0
+ assert r.zadd("a", {"a": 5}, lt=True, ch=True) == 0
+ assert r.zadd("a", {"a": 1}, lt=True, ch=True) == 1
- for i in range(1, 20):
- r.zadd("a", {f"a{i}": i})
- assert r.zadd("a", {"a20": 5}, gt=3) == 1
-
- for i in range(1, 20):
- r.zadd("a", {f"a{i}": i})
- assert r.zadd("a", {"a2": 5}, lt=1) == 0
-
- # cannot use both nx and xx options
+ # cannot combine both nx and xx options and gt and lt options
+ with pytest.raises(exceptions.DataError):
+ r.zadd("a", {"a15": 15}, nx=True, lt=True)
+ with pytest.raises(exceptions.DataError):
+ r.zadd("a", {"a15": 15}, nx=True, gt=True)
+ with pytest.raises(exceptions.DataError):
+ r.zadd("a", {"a15": 15}, lt=True, gt=True)
with pytest.raises(exceptions.DataError):
- r.zadd("a", {"a15": 155}, nx=True, lt=True)
- r.zadd("a", {"a15": 155}, nx=True, gt=True)
- r.zadd("a", {"a15": 155}, lt=True, gt=True)
+ r.zadd("a", {"a15": 15}, nx=True, xx=True)
def test_zcard(self, r):
r.zadd("a", {"a1": 1, "a2": 2, "a3": 3})