MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_or_and_as_columns

Method test_or_and_as_columns

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

Source from the content-addressed store, hash-verified

133
134 @testing.requires.boolean_col_expressions
135 def test_or_and_as_columns(self, connection):
136 true, false = literal(True), literal(False)
137
138 eq_(connection.execute(select(and_(true, false))).scalar(), False)
139 eq_(connection.execute(select(and_(true, true))).scalar(), True)
140 eq_(connection.execute(select(or_(true, false))).scalar(), True)
141 eq_(connection.execute(select(or_(false, false))).scalar(), False)
142 eq_(
143 connection.execute(select(not_(or_(false, false)))).scalar(),
144 True,
145 )
146
147 row = connection.execute(
148 select(or_(false, false).label("x"), and_(true, false).label("y"))
149 ).first()
150 assert row.x == False # noqa
151 assert row.y == False # noqa
152
153 row = connection.execute(
154 select(or_(true, false).label("x"), and_(true, false).label("y"))
155 ).first()
156 assert row.x == True # noqa
157 assert row.y == False # noqa
158
159 def test_select_tuple(self, connection):
160 users = self.tables.users

Callers

nothing calls this directly

Calls 10

literalFunction · 0.90
eq_Function · 0.90
selectFunction · 0.90
and_Function · 0.90
or_Function · 0.90
not_Function · 0.90
scalarMethod · 0.45
executeMethod · 0.45
firstMethod · 0.45
labelMethod · 0.45

Tested by

no test coverage detected