From b1ffbc91b2c0ee305dd9fd9ebe01654a7ec18e8b Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Sun, 6 Feb 2022 15:24:08 +0200 Subject: add support for lcs (#1924) --- tests/test_commands.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/test_commands.py') 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" -- cgit v1.2.1