MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_eager_list

Method test_eager_list

test/ext/test_associationproxy.py:1382–1403  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1380 self.assert_("_children" in p.__dict__)
1381
1382 def test_eager_list(self):
1383 Parent, Child = self.classes("Parent", "Child")
1384
1385 self.session = fixture_session()
1386
1387 self.mapper_registry.map_imperatively(
1388 Parent,
1389 self.tables.Parent,
1390 properties={
1391 "_children": relationship(
1392 Child, lazy="joined", collection_class=list
1393 )
1394 },
1395 )
1396
1397 p = Parent("p")
1398 p.children = ["a", "b", "c"]
1399
1400 p = self.roundtrip(p)
1401
1402 self.assert_("_children" in p.__dict__)
1403 self.assert_(len(p._children) == 3)
1404
1405 def test_slicing_list(self):
1406 Parent, Child = self.classes("Parent", "Child")

Callers

nothing calls this directly

Calls 6

roundtripMethod · 0.95
fixture_sessionFunction · 0.90
relationshipFunction · 0.90
map_imperativelyMethod · 0.80
ParentClass · 0.70
assert_Method · 0.45

Tested by

no test coverage detected