Skip to content

Commit c9a16c8

Browse files
committed
deprecate
1 parent ab5d407 commit c9a16c8

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

redis/commands/bf/commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from redis.client import NEVER_DECODE
22
from redis.exceptions import ModuleError
33
from redis.utils import HIREDIS_AVAILABLE
4+
from deprecated import deprecated
45

56
BF_RESERVE = "BF.RESERVE"
67
BF_ADD = "BF.ADD"
@@ -318,6 +319,7 @@ def query(self, key, *items):
318319
""" # noqa
319320
return self.execute_command(TOPK_QUERY, key, *items)
320321

322+
@deprecated(version="4.4.0", reason="deprecated since redisbloom 2.4.0")
321323
def count(self, key, *items):
322324
"""
323325
Return count for one `item` or more from `key`.

tests/test_asyncio/test_bloom.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,10 @@ async def test_topk(modclient: redis.Redis):
263263
assert [1, 1, 0, 0, 1, 0, 0] == await modclient.topk().query(
264264
"topk", "A", "B", "C", "D", "E", "F", "G"
265265
)
266-
assert [4, 3, 2, 3, 3, 0, 1] == await modclient.topk().count(
267-
"topk", "A", "B", "C", "D", "E", "F", "G"
268-
)
266+
with pytest.deprecated_call():
267+
assert [4, 3, 2, 3, 3, 0, 1] == await modclient.topk().count(
268+
"topk", "A", "B", "C", "D", "E", "F", "G"
269+
)
269270

270271
# test full list
271272
assert await modclient.topk().reserve("topklist", 3, 50, 3, 0.9)
@@ -307,9 +308,10 @@ async def test_topk_incrby(modclient: redis.Redis):
307308
)
308309
res = await modclient.topk().incrby("topk", ["42", "xyzzy"], [8, 4])
309310
assert [None, "bar"] == res
310-
assert [3, 6, 10, 4, 0] == await modclient.topk().count(
311-
"topk", "bar", "baz", "42", "xyzzy", 4
312-
)
311+
with pytest.deprecated_call():
312+
assert [3, 6, 10, 4, 0] == await modclient.topk().count(
313+
"topk", "bar", "baz", "42", "xyzzy", 4
314+
)
313315

314316

315317
# region Test T-Digest

tests/test_bloom.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,10 @@ def test_topk(client):
265265
assert [1, 1, 0, 0, 1, 0, 0] == client.topk().query(
266266
"topk", "A", "B", "C", "D", "E", "F", "G"
267267
)
268-
assert [4, 3, 2, 3, 3, 0, 1] == client.topk().count(
269-
"topk", "A", "B", "C", "D", "E", "F", "G"
270-
)
268+
with pytest.deprecated_call():
269+
assert [4, 3, 2, 3, 3, 0, 1] == client.topk().count(
270+
"topk", "A", "B", "C", "D", "E", "F", "G"
271+
)
271272

272273
# test full list
273274
assert client.topk().reserve("topklist", 3, 50, 3, 0.9)
@@ -307,9 +308,10 @@ def test_topk_incrby(client):
307308
"topk", ["bar", "baz", "42"], [3, 6, 2]
308309
)
309310
assert [None, "bar"] == client.topk().incrby("topk", ["42", "xyzzy"], [8, 4])
310-
assert [3, 6, 10, 4, 0] == client.topk().count(
311-
"topk", "bar", "baz", "42", "xyzzy", 4
312-
)
311+
with pytest.deprecated_call():
312+
assert [3, 6, 10, 4, 0] == client.topk().count(
313+
"topk", "bar", "baz", "42", "xyzzy", 4
314+
)
313315

314316

315317
# region Test T-Digest

0 commit comments

Comments
 (0)