MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_has

Method test_has

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

Source from the content-addressed store, hash-verified

2892 )
2893
2894 def test_has(self):
2895 Node = self.classes.Node
2896
2897 sess = fixture_session()
2898
2899 eq_(
2900 sess.query(Node)
2901 .filter(Node.parent.has(Node.data == "n12"))
2902 .order_by(Node.id)
2903 .all(),
2904 [Node(data="n121"), Node(data="n122"), Node(data="n123")],
2905 )
2906 eq_(
2907 sess.query(Node)
2908 .filter(Node.parent.has(Node.data == "n122"))
2909 .all(),
2910 [],
2911 )
2912 eq_(
2913 sess.query(Node).filter(~Node.parent.has()).all(),
2914 [Node(data="n1")],
2915 )
2916
2917 def test_contains(self):
2918 Node = self.classes.Node

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
eq_Function · 0.90
NodeClass · 0.70
allMethod · 0.45
order_byMethod · 0.45
filterMethod · 0.45
queryMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected