Skip to content

Commit 587718a

Browse files
committed
Add a test using a query where one attributes appears more than once
in the ORDER BY clause
1 parent f325880 commit 587718a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_06_query.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,27 @@ def test_query_order_jpql_function(client):
463463
assert res[0].fullName == "Nicolas Bourbaki"
464464
verify_rebuild_query(client, query, res)
465465

466+
def test_query_order_attribute_multiple(client):
467+
"""Add the same attribute more than once to the order.
468+
469+
The restriction that any attribute may only appear once to the
470+
order has been removed in #158.
471+
"""
472+
query = Query(client, 'User', order=[
473+
('LENGTH(fullName)', 'DESC'),
474+
('fullName', 'DESC'),
475+
])
476+
print(str(query))
477+
assert "User" in query.select_clause
478+
assert query.join_clause is None
479+
assert query.where_clause is None
480+
assert query.order_clause.count("fullName") == 2
481+
assert "LENGTH" in query.order_clause
482+
res = client.search(query)
483+
assert len(res) > 4
484+
assert res[4].fullName == "Aelius Cordus"
485+
verify_rebuild_query(client, query, res)
486+
466487
def test_query_rule_order(client):
467488
"""Rule does not have a constraint, id is included in the natural order.
468489
"""

0 commit comments

Comments
 (0)