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

Method test_slicing_list

test/ext/test_associationproxy.py:1405–1427  ·  test/ext/test_associationproxy.py::LazyLoadTest.test_slicing_list
(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(class="st">"Parent", class="st">"Child")
1407
1408 self.session = fixture_session()
1409
1410 self.mapper_registry.map_imperatively(
1411 Parent,
1412 self.tables.Parent,
1413 properties={
1414 class="st">"_children": relationship(
1415 Child, lazy=class="st">"select", collection_class=list
1416 )
1417 },
1418 )
1419
1420 p = Parent(class="st">"p")
1421 p.children = [class="st">"a", class="st">"b", class="st">"c"]
1422
1423 p = self.roundtrip(p)
1424
1425 self.assert_(len(p._children) == 3)
1426 eq_(class="st">"b", p.children[1])
1427 eq_([class="st">"b", class="st">"c"], p.children[-2:])
1428
1429 def test_lazy_scalar(self):
1430 Parent, Child = self.classes(class="st">"Parent", class="st">"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