MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_order_by_nulls

Method test_order_by_nulls

test/sql/test_compiler.py:2058–2107  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2056 )
2057
2058 def test_order_by_nulls(self):
2059 self.assert_compile(
2060 table2.select().order_by(
2061 table2.c.otherid,
2062 table2.c.othername.desc().nulls_first(),
2063 ),
2064 "SELECT myothertable.otherid, myothertable.othername FROM "
2065 "myothertable ORDER BY myothertable.otherid, "
2066 "myothertable.othername DESC NULLS FIRST",
2067 )
2068
2069 self.assert_compile(
2070 table2.select().order_by(
2071 table2.c.otherid,
2072 table2.c.othername.desc().nulls_last(),
2073 ),
2074 "SELECT myothertable.otherid, myothertable.othername FROM "
2075 "myothertable ORDER BY myothertable.otherid, "
2076 "myothertable.othername DESC NULLS LAST",
2077 )
2078
2079 self.assert_compile(
2080 table2.select().order_by(
2081 table2.c.otherid.nulls_last(),
2082 table2.c.othername.desc().nulls_first(),
2083 ),
2084 "SELECT myothertable.otherid, myothertable.othername FROM "
2085 "myothertable ORDER BY myothertable.otherid NULLS LAST, "
2086 "myothertable.othername DESC NULLS FIRST",
2087 )
2088
2089 self.assert_compile(
2090 table2.select().order_by(
2091 table2.c.otherid.nulls_first(),
2092 table2.c.othername.desc(),
2093 ),
2094 "SELECT myothertable.otherid, myothertable.othername FROM "
2095 "myothertable ORDER BY myothertable.otherid NULLS FIRST, "
2096 "myothertable.othername DESC",
2097 )
2098
2099 self.assert_compile(
2100 table2.select().order_by(
2101 table2.c.otherid.nulls_first(),
2102 table2.c.othername.desc().nulls_last(),
2103 ),
2104 "SELECT myothertable.otherid, myothertable.othername FROM "
2105 "myothertable ORDER BY myothertable.otherid NULLS FIRST, "
2106 "myothertable.othername DESC NULLS LAST",
2107 )
2108
2109 def test_orderby_groupby(self):
2110 self.assert_compile(

Callers

nothing calls this directly

Calls 6

assert_compileMethod · 0.80
order_byMethod · 0.45
selectMethod · 0.45
nulls_firstMethod · 0.45
descMethod · 0.45
nulls_lastMethod · 0.45

Tested by

no test coverage detected