(self)
| 903 | sess.close() |
| 904 | |
| 905 | def test_subqueryload_post_context(self): |
| 906 | User = self.classes.User |
| 907 | Address = self.classes.Address |
| 908 | |
| 909 | assert_result = [ |
| 910 | User( |
| 911 | id=7, addresses=[Address(id=1, email_address="jack@bean.com")] |
| 912 | ) |
| 913 | ] |
| 914 | |
| 915 | self.bakery = baked.bakery() |
| 916 | |
| 917 | bq = self.bakery(lambda s: s.query(User)) |
| 918 | |
| 919 | bq += lambda q: q.options(subqueryload(User.addresses)) |
| 920 | bq += lambda q: q.order_by(User.id) |
| 921 | bq += lambda q: q.filter(User.name == bindparam("name")) |
| 922 | sess = fixture_session() |
| 923 | |
| 924 | def set_params(q): |
| 925 | return q.params(name="jack") |
| 926 | |
| 927 | # test that the changes we make using with_post_criteria() |
| 928 | # are also applied to the subqueryload query. |
| 929 | def go(): |
| 930 | result = bq(sess).with_post_criteria(set_params).all() |
| 931 | eq_(assert_result, result) |
| 932 | |
| 933 | self.assert_sql_count(testing.db, go, 2) |
| 934 | |
| 935 | @testing.fixture() |
| 936 | def before_compile_nobake_fixture(self): |
nothing calls this directly
no test coverage detected