MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_lazy_scalar

Method test_lazy_scalar

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

Source from the content-addressed store, hash-verified

1427 eq_(["b", "c"], p.children[-2:])
1428
1429 def test_lazy_scalar(self):
1430 Parent, Child = self.classes("Parent", "Child")
1431
1432 self.session = fixture_session()
1433
1434 self.mapper_registry.map_imperatively(
1435 Parent,
1436 self.tables.Parent,
1437 properties={
1438 "_children": relationship(Child, lazy="select", uselist=False)
1439 },
1440 )
1441
1442 p = Parent("p")
1443 p.children = "value"
1444
1445 p = self.roundtrip(p)
1446
1447 self.assert_("_children" not in p.__dict__)
1448 self.assert_(p._children is not None)
1449
1450 def test_eager_scalar(self):
1451 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