summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-02-06 15:24:08 +0200
committerGitHub <noreply@github.com>2022-02-06 15:24:08 +0200
commitb1ffbc91b2c0ee305dd9fd9ebe01654a7ec18e8b (patch)
tree93cf68b9246bcd53a7ddcadcd048f1d0ca0131f8 /tests/test_commands.py
parent9b99bf98375574540a5f1642d0fd7900781d0761 (diff)
downloadredis-py-b1ffbc91b2c0ee305dd9fd9ebe01654a7ec18e8b.tar.gz
add support for lcs (#1924)
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 7d98665..0e27836 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -968,6 +968,17 @@ class TestRedisCommands:
assert r.get("a") is None
assert r.get("b") is None
+ @pytest.mark.onlynoncluster
+ # @skip_if_server_version_lt("7.0.0") turn on after redis 7 release
+ def test_lcs(self, unstable_r):
+ unstable_r.mset({"foo": "ohmytext", "bar": "mynewtext"})
+ assert unstable_r.lcs("foo", "bar") == b"mytext"
+ assert unstable_r.lcs("foo", "bar", len=True) == 6
+ result = [b"matches", [[[4, 7], [5, 8]]], b"len", 6]
+ assert unstable_r.lcs("foo", "bar", idx=True, minmatchlen=3) == result
+ with pytest.raises(redis.ResponseError):
+ assert unstable_r.lcs("foo", "bar", len=True, idx=True)
+
@skip_if_server_version_lt("2.6.0")
def test_dump_and_restore(self, r):
r["a"] = "foo"