summaryrefslogtreecommitdiff
path: root/tests/test_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_search.py')
-rw-r--r--tests/test_search.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/test_search.py b/tests/test_search.py
index 12876f6..57d4338 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -973,16 +973,26 @@ def test_aggregations_filter(client):
client.ft().client.hset("doc1", mapping={"name": "bar", "age": "25"})
client.ft().client.hset("doc2", mapping={"name": "foo", "age": "19"})
- req = aggregations.AggregateRequest("*").filter("@name=='foo' && @age < 20")
- res = client.ft().aggregate(req)
- assert len(res.rows) == 1
- assert res.rows[0] == ["name", "foo", "age", "19"]
-
- req = aggregations.AggregateRequest("*").filter("@age > 15").sort_by("@age")
- res = client.ft().aggregate(req)
- assert len(res.rows) == 2
- assert res.rows[0] == ["age", "19"]
- assert res.rows[1] == ["age", "25"]
+ for dialect in [1, 2]:
+ req = (
+ aggregations.AggregateRequest("*")
+ .filter("@name=='foo' && @age < 20")
+ .dialect(dialect)
+ )
+ res = client.ft().aggregate(req)
+ assert len(res.rows) == 1
+ assert res.rows[0] == ["name", "foo", "age", "19"]
+
+ req = (
+ aggregations.AggregateRequest("*")
+ .filter("@age > 15")
+ .sort_by("@age")
+ .dialect(dialect)
+ )
+ res = client.ft().aggregate(req)
+ assert len(res.rows) == 2
+ assert res.rows[0] == ["age", "19"]
+ assert res.rows[1] == ["age", "25"]
@pytest.mark.redismod