MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_any

Method test_any

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

Source from the content-addressed store, hash-verified

2862 )
2863
2864 def test_any(self):
2865 Node = self.classes.Node
2866
2867 sess = fixture_session()
2868 eq_(
2869 sess.query(Node)
2870 .filter(Node.children.any(Node.data == "n1"))
2871 .all(),
2872 [],
2873 )
2874 eq_(
2875 sess.query(Node)
2876 .filter(Node.children.any(Node.data == "n12"))
2877 .all(),
2878 [Node(data="n1")],
2879 )
2880 eq_(
2881 sess.query(Node)
2882 .filter(~Node.children.any())
2883 .order_by(Node.id)
2884 .all(),
2885 [
2886 Node(data="n11"),
2887 Node(data="n13"),
2888 Node(data="n121"),
2889 Node(data="n122"),
2890 Node(data="n123"),
2891 ],
2892 )
2893
2894 def test_has(self):
2895 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
filterMethod · 0.45
queryMethod · 0.45
anyMethod · 0.45
order_byMethod · 0.45

Tested by

no test coverage detected