MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _do_query_tests

Method _do_query_tests

test/orm/test_selectin_relations.py:757–788  ·  view source on GitHub ↗
(self, opts, count)

Source from the content-addressed store, hash-verified

755 clear_mappers()
756
757 def _do_query_tests(self, opts, count):
758 Order, User = self.classes.Order, self.classes.User
759
760 with fixture_session() as sess:
761
762 def go():
763 eq_(
764 sess.query(User).options(*opts).order_by(User.id).all(),
765 self.static.user_item_keyword_result,
766 )
767
768 self.assert_sql_count(testing.db, go, count)
769
770 eq_(
771 sess.query(User)
772 .options(*opts)
773 .filter(User.name == "fred")
774 .order_by(User.id)
775 .all(),
776 self.static.user_item_keyword_result[2:3],
777 )
778
779 with fixture_session() as sess:
780 eq_(
781 sess.query(User)
782 .options(*opts)
783 .join(User.orders)
784 .filter(Order.id == 3)
785 .order_by(User.id)
786 .all(),
787 self.static.user_item_keyword_result[0:1],
788 )
789
790 def test_cyclical(self):
791 """A circular eager relationship breaks the cycle with a lazy loader"""

Callers 2

_do_options_testMethod · 0.95
_do_mapper_testMethod · 0.95

Calls 9

fixture_sessionFunction · 0.90
eq_Function · 0.90
assert_sql_countMethod · 0.80
allMethod · 0.45
order_byMethod · 0.45
filterMethod · 0.45
optionsMethod · 0.45
queryMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected