MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_attribute_sanity

Method test_attribute_sanity

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

Source from the content-addressed store, hash-verified

259 assert not hasattr(c1, "__dict__")
260
261 def test_attribute_sanity(self):
262 assert hasattr(table1, "c")
263 assert hasattr(table1.select().subquery(), "c")
264 assert not hasattr(table1.c.myid.self_group(), "columns")
265 assert not hasattr(table1.c.myid, "columns")
266 assert not hasattr(table1.c.myid, "c")
267 assert not hasattr(table1.select().subquery().c.myid, "c")
268 assert not hasattr(table1.select().subquery().c.myid, "columns")
269 assert not hasattr(table1.alias().c.myid, "columns")
270 assert not hasattr(table1.alias().c.myid, "c")
271
272 assert_raises_message(
273 exc.InvalidRequestError,
274 "Scalar Select expression has no "
275 "columns; use this object directly within a "
276 "column-level expression.",
277 getattr,
278 select(table1.c.myid).scalar_subquery().self_group(),
279 "columns",
280 )
281
282 assert_raises_message(
283 exc.InvalidRequestError,
284 "Scalar Select expression has no "
285 "columns; use this object directly within a "
286 "column-level expression.",
287 getattr,
288 select(table1.c.myid).scalar_subquery(),
289 "columns",
290 )
291
292 def test_table_select(self):
293 self.assert_compile(

Callers

nothing calls this directly

Calls 7

assert_raises_messageFunction · 0.90
selectFunction · 0.90
subqueryMethod · 0.45
selectMethod · 0.45
self_groupMethod · 0.45
aliasMethod · 0.45
scalar_subqueryMethod · 0.45

Tested by

no test coverage detected