MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_contains

Method test_contains

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

Source from the content-addressed store, hash-verified

3045 )
3046
3047 def test_contains(self):
3048 Node = self.classes.Node
3049
3050 sess = fixture_session()
3051 n4 = sess.query(Node).filter_by(data="n4").one()
3052
3053 eq_(
3054 sess.query(Node)
3055 .filter(Node.children.contains(n4))
3056 .order_by(Node.data)
3057 .all(),
3058 [Node(data="n1"), Node(data="n3")],
3059 )
3060 eq_(
3061 sess.query(Node)
3062 .filter(not_(Node.children.contains(n4)))
3063 .order_by(Node.data)
3064 .all(),
3065 [
3066 Node(data="n2"),
3067 Node(data="n4"),
3068 Node(data="n5"),
3069 Node(data="n6"),
3070 Node(data="n7"),
3071 ],
3072 )
3073
3074 def test_explicit_join(self):
3075 Node = self.classes.Node

Callers

nothing calls this directly

Calls 11

fixture_sessionFunction · 0.90
eq_Function · 0.90
not_Function · 0.90
NodeClass · 0.70
oneMethod · 0.45
filter_byMethod · 0.45
queryMethod · 0.45
allMethod · 0.45
order_byMethod · 0.45
filterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected