MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_spoiled_full_w_params

Method test_spoiled_full_w_params

test/ext/test_baked.py:553–594  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

551 )
552
553 def test_spoiled_full_w_params(self):
554 User = self.classes.User
555
556 canary = mock.Mock()
557
558 def fn1(s):
559 canary.fn1()
560 return s.query(User.id, User.name).order_by(User.id)
561
562 def fn2(q):
563 canary.fn2()
564 return q.filter(User.id == bindparam("id"))
565
566 def fn3(q):
567 canary.fn3()
568 return q
569
570 for x in range(3):
571 bq = self.bakery(fn1)
572
573 bq += fn2
574
575 sess = fixture_session()
576 eq_(
577 bq.spoil(full=True).add_criteria(fn3)(sess).params(id=7).all(),
578 [(7, "jack")],
579 )
580
581 eq_(
582 canary.mock_calls,
583 [
584 mock.call.fn1(),
585 mock.call.fn2(),
586 mock.call.fn3(),
587 mock.call.fn1(),
588 mock.call.fn2(),
589 mock.call.fn3(),
590 mock.call.fn1(),
591 mock.call.fn2(),
592 mock.call.fn3(),
593 ],
594 )
595
596 def test_spoiled_half_w_params(self):
597 User = self.classes.User

Callers

nothing calls this directly

Calls 10

fixture_sessionFunction · 0.90
eq_Function · 0.90
bakeryMethod · 0.80
allMethod · 0.45
paramsMethod · 0.45
add_criteriaMethod · 0.45
spoilMethod · 0.45
fn1Method · 0.45
fn2Method · 0.45
fn3Method · 0.45

Tested by

no test coverage detected