MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_join_to_nonaliased

Method test_join_to_nonaliased

test/orm/test_joins.py:2716–2744  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2714 )
2715
2716 def test_join_to_nonaliased(self):
2717 Node = self.classes.Node
2718
2719 sess = fixture_session()
2720
2721 n1 = aliased(Node)
2722
2723 # using 'n1.parent' implicitly joins to unaliased Node
2724 eq_(
2725 sess.query(n1).join(n1.parent).filter(Node.data == "n1").all(),
2726 [
2727 Node(parent_id=1, data="n11", id=2),
2728 Node(parent_id=1, data="n12", id=3),
2729 Node(parent_id=1, data="n13", id=4),
2730 ],
2731 )
2732
2733 # explicit (new syntax)
2734 eq_(
2735 sess.query(n1)
2736 .join(Node, n1.parent)
2737 .filter(Node.data == "n1")
2738 .all(),
2739 [
2740 Node(parent_id=1, data="n11", id=2),
2741 Node(parent_id=1, data="n12", id=3),
2742 Node(parent_id=1, data="n13", id=4),
2743 ],
2744 )
2745
2746 def test_multiple_explicit_entities_one(self):
2747 Node = self.classes.Node

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
aliasedFunction · 0.90
eq_Function · 0.90
NodeClass · 0.70
allMethod · 0.45
filterMethod · 0.45
joinMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected