MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_o2m

Method test_o2m

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

Source from the content-addressed store, hash-verified

6417 with_parent(u1, "orders")
6418
6419 def test_o2m(self):
6420 User, Order = (
6421 self.classes.User,
6422 self.classes.Order,
6423 )
6424
6425 sess = fixture_session()
6426 q = sess.query(User)
6427
6428 u1 = q.filter_by(name="jack").one()
6429
6430 o = sess.query(Order).filter(with_parent(u1, User.orders)).all()
6431 assert [
6432 Order(description="order 1"),
6433 Order(description="order 3"),
6434 Order(description="order 5"),
6435 ] == o
6436
6437 def test_invalid_property(self):
6438 """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