(self)
| 594 | ) |
| 595 | |
| 596 | def test_spoiled_half_w_params(self): |
| 597 | User = self.classes.User |
| 598 | |
| 599 | canary = mock.Mock() |
| 600 | |
| 601 | def fn1(s): |
| 602 | canary.fn1() |
| 603 | return s.query(User.id, User.name).order_by(User.id) |
| 604 | |
| 605 | def fn2(q): |
| 606 | canary.fn2() |
| 607 | return q.filter(User.id == bindparam("id")) |
| 608 | |
| 609 | def fn3(q): |
| 610 | canary.fn3() |
| 611 | return q |
| 612 | |
| 613 | bq = self.bakery(fn1) |
| 614 | |
| 615 | bq += fn2 |
| 616 | |
| 617 | for x in range(3): |
| 618 | bq = self.bakery(fn1) |
| 619 | |
| 620 | bq += fn2 |
| 621 | |
| 622 | sess = fixture_session() |
| 623 | eq_( |
| 624 | bq.spoil().add_criteria(fn3)(sess).params(id=7).all(), |
| 625 | [(7, "jack")], |
| 626 | ) |
| 627 | |
| 628 | eq_( |
| 629 | canary.mock_calls, |
| 630 | [ |
| 631 | mock.call.fn1(), |
| 632 | mock.call.fn2(), |
| 633 | mock.call.fn3(), |
| 634 | mock.call.fn3(), |
| 635 | mock.call.fn3(), |
| 636 | ], |
| 637 | ) |
| 638 | |
| 639 | def test_w_new_entities(self): |
| 640 | """Test that the query can have its entities modified in |
nothing calls this directly
no test coverage detected