diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-09-04 10:53:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 10:53:22 +0300 |
commit | 744cb09055e464ceb233d80d2c4efa6ec2119aad (patch) | |
tree | 735f822dc31f19f382662dfddb3b4243a226fd69 | |
parent | 37344582ec8689035d9106a2141409e78be2606d (diff) | |
download | redis-py-744cb09055e464ceb233d80d2c4efa6ec2119aad.tar.gz |
Mark `TOPK.COUNT` as deprecated (#2363)
* deprecate
* linters
-rw-r--r-- | redis/commands/bf/commands.py | 3 | ||||
-rw-r--r-- | tests/test_asyncio/test_bloom.py | 14 | ||||
-rw-r--r-- | tests/test_bloom.py | 14 |
3 files changed, 19 insertions, 12 deletions
diff --git a/redis/commands/bf/commands.py b/redis/commands/bf/commands.py index 9c3c97c..3d085e6 100644 --- a/redis/commands/bf/commands.py +++ b/redis/commands/bf/commands.py @@ -1,3 +1,5 @@ +from deprecated import deprecated + from redis.client import NEVER_DECODE from redis.exceptions import ModuleError from redis.utils import HIREDIS_AVAILABLE @@ -322,6 +324,7 @@ class TOPKCommands: """ # noqa return self.execute_command(TOPK_QUERY, key, *items) + @deprecated(version="4.4.0", reason="deprecated since redisbloom 2.4.0") def count(self, key, *items): """ Return count for one `item` or more from `key`. diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py index 8e642d2..162a442 100644 --- a/tests/test_asyncio/test_bloom.py +++ b/tests/test_asyncio/test_bloom.py @@ -263,9 +263,10 @@ async def test_topk(modclient: redis.Redis): assert [1, 1, 0, 0, 1, 0, 0] == await modclient.topk().query( "topk", "A", "B", "C", "D", "E", "F", "G" ) - assert [4, 3, 2, 3, 3, 0, 1] == await modclient.topk().count( - "topk", "A", "B", "C", "D", "E", "F", "G" - ) + with pytest.deprecated_call(): + assert [4, 3, 2, 3, 3, 0, 1] == await modclient.topk().count( + "topk", "A", "B", "C", "D", "E", "F", "G" + ) # test full list assert await modclient.topk().reserve("topklist", 3, 50, 3, 0.9) @@ -307,9 +308,10 @@ async def test_topk_incrby(modclient: redis.Redis): ) res = await modclient.topk().incrby("topk", ["42", "xyzzy"], [8, 4]) assert [None, "bar"] == res - assert [3, 6, 10, 4, 0] == await modclient.topk().count( - "topk", "bar", "baz", "42", "xyzzy", 4 - ) + with pytest.deprecated_call(): + assert [3, 6, 10, 4, 0] == await modclient.topk().count( + "topk", "bar", "baz", "42", "xyzzy", 4 + ) # region Test T-Digest diff --git a/tests/test_bloom.py b/tests/test_bloom.py index 2ff2ea7..54fcd69 100644 --- a/tests/test_bloom.py +++ b/tests/test_bloom.py @@ -280,9 +280,10 @@ def test_topk(client): assert [1, 1, 0, 0, 1, 0, 0] == client.topk().query( "topk", "A", "B", "C", "D", "E", "F", "G" ) - assert [4, 3, 2, 3, 3, 0, 1] == client.topk().count( - "topk", "A", "B", "C", "D", "E", "F", "G" - ) + with pytest.deprecated_call(): + assert [4, 3, 2, 3, 3, 0, 1] == client.topk().count( + "topk", "A", "B", "C", "D", "E", "F", "G" + ) # test full list assert client.topk().reserve("topklist", 3, 50, 3, 0.9) @@ -322,9 +323,10 @@ def test_topk_incrby(client): "topk", ["bar", "baz", "42"], [3, 6, 2] ) assert [None, "bar"] == client.topk().incrby("topk", ["42", "xyzzy"], [8, 4]) - assert [3, 6, 10, 4, 0] == client.topk().count( - "topk", "bar", "baz", "42", "xyzzy", 4 - ) + with pytest.deprecated_call(): + assert [3, 6, 10, 4, 0] == client.topk().count( + "topk", "bar", "baz", "42", "xyzzy", 4 + ) # region Test T-Digest |