summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-08-02 17:45:14 +0300
committerGitHub <noreply@github.com>2022-08-02 17:45:14 +0300
commitfcc0c4114a7142ba58daed0cdafbbbaefe1680a6 (patch)
tree9e4ca1ba8b630f24717f4c21373f15e47a6d5885 /tests
parent19cedab73a9b7d8e6af2753a1206e79c50ee2d37 (diff)
downloadredis-py-fcc0c4114a7142ba58daed0cdafbbbaefe1680a6.tar.gz
Support TDIGEST.MERGESTORE and make compression optional on TDIGEST.CREATE (#2319)
* support 2.4 * async test * skip tests * linters
Diffstat (limited to 'tests')
-rw-r--r--tests/test_asyncio/test_bloom.py13
-rw-r--r--tests/test_bloom.py13
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py
index fe3bd76..15b22b3 100644
--- a/tests/test_asyncio/test_bloom.py
+++ b/tests/test_asyncio/test_bloom.py
@@ -393,6 +393,19 @@ async def test_tdigest_cdf(modclient: redis.Redis):
assert 0.9 == round(await modclient.tdigest().cdf("tDigest", 9.0), 1)
+@pytest.mark.redismod
+@pytest.mark.experimental
+@skip_ifmodversion_lt("2.4.0", "bf")
+async def test_tdigest_mergestore(modclient: redis.Redis):
+ assert await modclient.tdigest().create("sourcekey1", 100)
+ assert await modclient.tdigest().create("sourcekey2", 100)
+ assert await modclient.tdigest().add("sourcekey1", [10], [1.0])
+ assert await modclient.tdigest().add("sourcekey2", [50], [1.0])
+ assert await modclient.tdigest().mergestore("dest", 2, "sourcekey1", "sourcekey2")
+ assert await modclient.tdigest().max("dest") == 50
+ assert await modclient.tdigest().min("dest") == 10
+
+
# @pytest.mark.redismod
# async def test_pipeline(modclient: redis.Redis):
# pipeline = await modclient.bf().pipeline()
diff --git a/tests/test_bloom.py b/tests/test_bloom.py
index 340e48e..1191542 100644
--- a/tests/test_bloom.py
+++ b/tests/test_bloom.py
@@ -388,6 +388,19 @@ def test_tdigest_cdf(client):
assert 0.9 == round(client.tdigest().cdf("tDigest", 9.0), 1)
+@pytest.mark.redismod
+@pytest.mark.experimental
+@skip_ifmodversion_lt("2.4.0", "bf")
+def test_tdigest_mergestore(client):
+ assert client.tdigest().create("sourcekey1", 100)
+ assert client.tdigest().create("sourcekey2", 100)
+ assert client.tdigest().add("sourcekey1", [10], [1.0])
+ assert client.tdigest().add("sourcekey2", [50], [1.0])
+ assert client.tdigest().mergestore("destkey", 2, "sourcekey1", "sourcekey2")
+ assert client.tdigest().max("destkey") == 50
+ assert client.tdigest().min("destkey") == 10
+
+
# @pytest.mark.redismod
# def test_pipeline(client):
# pipeline = client.bf().pipeline()