diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-08-14 12:49:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-14 12:49:02 +0300 |
commit | 29f80a5e9e6c3e55aeaba91399d5c21dde8acb14 (patch) | |
tree | d70fbe718ec07ce9635ad91503fe9a137a6fe9ee | |
parent | 2cea637b2e936265d2001043d2b2d4e62559dc17 (diff) | |
download | redis-py-29f80a5e9e6c3e55aeaba91399d5c21dde8acb14.tar.gz |
Fix GRAPH.LIST & TDIGEST.QUANTILE tests (#2335)
* fix graph list_keys test
* async test
* fix tdigest.quantile
* fix
-rw-r--r-- | tests/test_asyncio/test_bloom.py | 10 | ||||
-rw-r--r-- | tests/test_asyncio/test_graph.py | 4 | ||||
-rw-r--r-- | tests/test_bloom.py | 10 | ||||
-rw-r--r-- | tests/test_graph.py | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py index 15b22b3..8e642d2 100644 --- a/tests/test_asyncio/test_bloom.py +++ b/tests/test_asyncio/test_bloom.py @@ -366,21 +366,21 @@ async def test_tdigest_quantile(modclient: redis.Redis): # assert min min/max have same result as quantile 0 and 1 assert ( await modclient.tdigest().max("tDigest") - == (await modclient.tdigest().quantile("tDigest", 1.0))[1] + == (await modclient.tdigest().quantile("tDigest", 1.0))[0] ) assert ( await modclient.tdigest().min("tDigest") - == (await modclient.tdigest().quantile("tDigest", 0.0))[1] + == (await modclient.tdigest().quantile("tDigest", 0.0))[0] ) - assert 1.0 == round((await modclient.tdigest().quantile("tDigest", 0.01))[1], 2) - assert 99.0 == round((await modclient.tdigest().quantile("tDigest", 0.99))[1], 2) + assert 1.0 == round((await modclient.tdigest().quantile("tDigest", 0.01))[0], 2) + assert 99.0 == round((await modclient.tdigest().quantile("tDigest", 0.99))[0], 2) # test multiple quantiles assert await modclient.tdigest().create("t-digest", 100) assert await modclient.tdigest().add("t-digest", [1, 2, 3, 4, 5], [1.0] * 5) res = await modclient.tdigest().quantile("t-digest", 0.5, 0.8) - assert [0.5, 3.0, 0.8, 5.0] == res + assert [3.0, 5.0] == res @pytest.mark.redismod diff --git a/tests/test_asyncio/test_graph.py b/tests/test_asyncio/test_graph.py index 8a8f9cf..0c011bd 100644 --- a/tests/test_asyncio/test_graph.py +++ b/tests/test_asyncio/test_graph.py @@ -348,11 +348,11 @@ async def test_list_keys(modclient: redis.Redis): result = await modclient.graph().list_keys() assert result == [] - await modclient.execute_command("GRAPH.EXPLAIN", "G", "RETURN 1") + await modclient.graph("G").query("CREATE (n)") result = await modclient.graph().list_keys() assert result == ["G"] - await modclient.execute_command("GRAPH.EXPLAIN", "X", "RETURN 1") + await modclient.graph("X").query("CREATE (m)") result = await modclient.graph().list_keys() assert result == ["G", "X"] diff --git a/tests/test_bloom.py b/tests/test_bloom.py index 12a4839..9a3e4a4 100644 --- a/tests/test_bloom.py +++ b/tests/test_bloom.py @@ -365,17 +365,17 @@ def test_tdigest_quantile(client): ) # assert min min/max have same result as quantile 0 and 1 res = client.tdigest().quantile("tDigest", 1.0) - assert client.tdigest().max("tDigest") == res[1] + assert client.tdigest().max("tDigest") == res[0] res = client.tdigest().quantile("tDigest", 0.0) - assert client.tdigest().min("tDigest") == res[1] + assert client.tdigest().min("tDigest") == res[0] - assert 1.0 == round(client.tdigest().quantile("tDigest", 0.01)[1], 2) - assert 99.0 == round(client.tdigest().quantile("tDigest", 0.99)[1], 2) + assert 1.0 == round(client.tdigest().quantile("tDigest", 0.01)[0], 2) + assert 99.0 == round(client.tdigest().quantile("tDigest", 0.99)[0], 2) # test multiple quantiles assert client.tdigest().create("t-digest", 100) assert client.tdigest().add("t-digest", [1, 2, 3, 4, 5], [1.0] * 5) - assert [0.5, 3.0, 0.8, 5.0] == client.tdigest().quantile("t-digest", 0.5, 0.8) + assert [3.0, 5.0] == client.tdigest().quantile("t-digest", 0.5, 0.8) @pytest.mark.redismod diff --git a/tests/test_graph.py b/tests/test_graph.py index 526308c..a46c336 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -366,11 +366,11 @@ def test_list_keys(client): result = client.graph().list_keys() assert result == [] - client.execute_command("GRAPH.EXPLAIN", "G", "RETURN 1") + client.graph("G").query("CREATE (n)") result = client.graph().list_keys() assert result == ["G"] - client.execute_command("GRAPH.EXPLAIN", "X", "RETURN 1") + client.graph("X").query("CREATE (m)") result = client.graph().list_keys() assert result == ["G", "X"] |