summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index bc0a2e9c3..b34eaeaae 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -921,6 +921,37 @@ class SelectTest(TestBase, AssertsCompiledSQL):
"OR mytable.myid = :myid_2 OR mytable.myid = :myid_3"
)
+ def test_order_by_nulls(self):
+ self.assert_compile(
+ table2.select(order_by = [table2.c.otherid, table2.c.othername.desc().nullsfirst()]),
+ "SELECT myothertable.otherid, myothertable.othername FROM "
+ "myothertable ORDER BY myothertable.otherid, myothertable.othername DESC NULLS FIRST"
+ )
+
+ self.assert_compile(
+ table2.select(order_by = [table2.c.otherid, table2.c.othername.desc().nullslast()]),
+ "SELECT myothertable.otherid, myothertable.othername FROM "
+ "myothertable ORDER BY myothertable.otherid, myothertable.othername DESC NULLS LAST"
+ )
+
+ self.assert_compile(
+ table2.select(order_by = [table2.c.otherid.nullslast(), table2.c.othername.desc().nullsfirst()]),
+ "SELECT myothertable.otherid, myothertable.othername FROM "
+ "myothertable ORDER BY myothertable.otherid NULLS LAST, myothertable.othername DESC NULLS FIRST"
+ )
+
+ self.assert_compile(
+ table2.select(order_by = [table2.c.otherid.nullsfirst(), table2.c.othername.desc()]),
+ "SELECT myothertable.otherid, myothertable.othername FROM "
+ "myothertable ORDER BY myothertable.otherid NULLS FIRST, myothertable.othername DESC"
+ )
+
+ self.assert_compile(
+ table2.select(order_by = [table2.c.otherid.nullsfirst(), table2.c.othername.desc().nullslast()]),
+ "SELECT myothertable.otherid, myothertable.othername FROM "
+ "myothertable ORDER BY myothertable.otherid NULLS FIRST, myothertable.othername DESC NULLS LAST"
+ )
+
def test_orderby_groupby(self):
self.assert_compile(
table2.select(order_by = [table2.c.otherid, asc(table2.c.othername)]),