MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_slicing_list

Method test_slicing_list

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

Source from the content-addressed store, hash-verified

1403 self.assert_(len(p._children) == 3)
1404
1405 def test_slicing_list(self):
1406 Parent, Child = self.classes("Parent", "Child")
1407
1408 self.session = fixture_session()
1409
1410 self.mapper_registry.map_imperatively(
1411 Parent,
1412 self.tables.Parent,
1413 properties={
1414 "_children": relationship(
1415 Child, lazy="select", collection_class=list
1416 )
1417 },
1418 )
1419
1420 p = Parent("p")
1421 p.children = ["a", "b", "c"]
1422
1423 p = self.roundtrip(p)
1424
1425 self.assert_(len(p._children) == 3)
1426 eq_("b", p.children[1])
1427 eq_(["b", "c"], p.children[-2:])
1428
1429 def test_lazy_scalar(self):
1430 Parent, Child = self.classes("Parent", "Child")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected