MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_hybrid_descriptor_one

Method test_hybrid_descriptor_one

test/orm/test_utils.py:298–316  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

296 assert child.table is table
297
298 def test_hybrid_descriptor_one(self):
299 class Point:
300 def __init__(self, x, y):
301 self.x, self.y = x, y
302
303 @hybrid_method
304 def left_of(self, other):
305 return self.x < other.x
306
307 self._fixture(Point)
308 alias = aliased(Point)
309 sess = fixture_session()
310
311 self.assert_compile(
312 sess.query(alias).filter(alias.left_of(Point)),
313 "SELECT point_1.id AS point_1_id, point_1.x AS point_1_x, "
314 "point_1.y AS point_1_y FROM point AS point_1, point "
315 "WHERE point_1.x < point.x",
316 )
317
318 def test_hybrid_descriptor_two(self):
319 class Point:

Callers

nothing calls this directly

Calls 7

_fixtureMethod · 0.95
aliasedFunction · 0.90
fixture_sessionFunction · 0.90
assert_compileMethod · 0.80
left_ofMethod · 0.80
filterMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected