Example #1
0
 def test_many_to_many_backref_population(self):
     articles = (self.session.query(self.Article).order_by(
         self.Article.id1).all())
     batch_fetch(
         articles,
         with_backrefs('tags'),
     )
     query_count = self.connection.query_count
     tags = articles[0].tags
     tags2 = articles[3].tags
     tags[0].articles
     tags2[0].articles
     names = [article.name for article in tags[0].articles]
     assert u'Article 1' in names
     assert self.connection.query_count == query_count
Example #2
0
 def test_many_to_many_backref_population(self):
     self.init_data()
     categories = self.session.query(self.Category).all()
     batch_fetch(
         categories,
         'articles',
         with_backrefs('articles.tags'),
     )
     query_count = self.connection.query_count
     tags = categories[0].articles[0].tags
     tags2 = categories[1].articles[1].tags
     tags[0].articles
     tags2[0].articles
     names = [article.name for article in tags[0].articles]
     assert u'Article 1' in names
     assert self.connection.query_count == query_count
 def test_many_to_many_backref_population(self):
     self.init_data()
     categories = self.session.query(self.Category).all()
     batch_fetch(
         categories,
         'articles',
         with_backrefs('articles.tags'),
     )
     query_count = self.connection.query_count
     tags = categories[0].articles[0].tags
     tags2 = categories[1].articles[1].tags
     tags[0].articles
     tags2[0].articles
     names = [article.name for article in tags[0].articles]
     assert u'Article 1' in names
     assert self.connection.query_count == query_count
 def test_many_to_many_backref_population(self):
     articles = (
         self.session.query(self.Article)
         .order_by(self.Article.id1).all()
     )
     batch_fetch(
         articles,
         with_backrefs('tags'),
     )
     query_count = self.connection.query_count
     tags = articles[0].tags
     tags2 = articles[3].tags
     tags[0].articles
     tags2[0].articles
     names = [article.name for article in tags[0].articles]
     assert u'Article 1' in names
     assert self.connection.query_count == query_count