MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_w_new_entities

Method test_w_new_entities

test/ext/test_baked.py:639–655  ·  view source on GitHub ↗

Test that the query can have its entities modified in an arbitrary callable, and that this new entity list is preserved when the query is invoked.

(self)

Source from the content-addressed store, hash-verified

637 )
638
639 def test_w_new_entities(self):
640 """Test that the query can have its entities modified in
641 an arbitrary callable, and that this new entity list is preserved
642 when the query is invoked.
643
644 """
645 User = self.classes.User
646
647 bq = self.bakery(lambda s: s.query(User.id, User.name))
648
649 bq += lambda q: q._legacy_from_self().with_entities(
650 func.count(User.id)
651 )
652
653 for i in range(3):
654 session = fixture_session()
655 eq_(bq(session).all(), [(4,)])
656
657 def test_conditional_step(self):
658 """Test a large series of conditionals and assert that

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
eq_Function · 0.90
bakeryMethod · 0.80
with_entitiesMethod · 0.80
_legacy_from_selfMethod · 0.80
queryMethod · 0.45
countMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected