MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_o2m

Method test_o2m

test/orm/test_query.py:5894–5910  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5892 with_parent(u1, "orders")
5893
5894 def test_o2m(self):
5895 User, Order = (
5896 self.classes.User,
5897 self.classes.Order,
5898 )
5899
5900 sess = fixture_session()
5901 q = sess.query(User)
5902
5903 u1 = q.filter_by(name="jack").one()
5904
5905 o = sess.query(Order).filter(with_parent(u1, User.orders)).all()
5906 assert [
5907 Order(description="order 1"),
5908 Order(description="order 3"),
5909 Order(description="order 5"),
5910 ] == o
5911
5912 def test_invalid_property(self):
5913 """Test if with_parent is passed a non-relationship

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
with_parentFunction · 0.90
OrderClass · 0.70
queryMethod · 0.45
oneMethod · 0.45
filter_byMethod · 0.45
allMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected