MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_order_by_label_compound

Method test_order_by_label_compound

test/sql/test_query.py:115–132  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

113
114 @testing.requires.order_by_label_with_expression
115 def test_order_by_label_compound(self, connection):
116 users = self.tables.users
117 connection.execute(
118 users.insert(),
119 [
120 {"user_id": 7, "user_name": "jack"},
121 {"user_id": 8, "user_name": "ed"},
122 {"user_id": 9, "user_name": "fred"},
123 ],
124 )
125
126 concat = ("test: " + users.c.user_name).label("thedata")
127 eq_(
128 connection.execute(
129 select(concat).order_by(literal_column("thedata") + "x")
130 ).fetchall(),
131 [("test: ed",), ("test: fred",), ("test: jack",)],
132 )
133
134 @testing.requires.boolean_col_expressions
135 def test_or_and_as_columns(self, connection):

Callers

nothing calls this directly

Calls 8

eq_Function · 0.90
selectFunction · 0.90
literal_columnFunction · 0.90
executeMethod · 0.45
insertMethod · 0.45
labelMethod · 0.45
fetchallMethod · 0.45
order_byMethod · 0.45

Tested by

no test coverage detected