  
          # When you call __str__ on the query object, it doesn't know about using
          # so it falls back to the default. If the subquery explicitly uses a
          # different database, an error should be raised.
          self.assertRaises(ValueError, str, qs.query)
  
          # Evaluating the query shouldn't work, either
          with self.assertRaises(ValueError):
              for obj in qs:
                  pass
 
</s> remove         self.assertRaises(ValueError, Author.objects.annotate, friends=Count('friends'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(friends=Count('friends')) </s> remove             self.assertRaises(IndexError, lambda: IndexErrorArticle.objects.all()[0])
            self.assertRaises(IndexError, IndexErrorArticle.objects.all().first)
            self.assertRaises(IndexError, IndexErrorArticle.objects.all().last)
 </s> add             with self.assertRaises(IndexError):
                IndexErrorArticle.objects.all()[0]
            with self.assertRaises(IndexError):
                IndexErrorArticle.objects.all().first()
            with self.assertRaises(IndexError):
                IndexErrorArticle.objects.all().last() </s> remove             self.assertRaises(GEOSException, fg._get_ptr)
 </s> add             with self.assertRaises(GEOSException):
                fg._get_ptr() </s> remove         self.assertRaises(Exception, cursor.executemany, query, [(1, 2, 3)])
        self.assertRaises(Exception, cursor.executemany, query, [(1,)])
 </s> add         with self.assertRaises(Exception):
            cursor.executemany(query, [(1, 2, 3)])
        with self.assertRaises(Exception):
            cursor.executemany(query, [(1,)]) </s> remove         self.assertRaises(ValueError, qs.aggregate, Union('name'))
 </s> add         with self.assertRaises(ValueError):
            qs.aggregate(Union('name'))
        with self.assertRaises(ValueError):
            str(qs.query)
  
          # When you call __str__ on the query object, it doesn't know about using
          # so it falls back to the default. If the subquery explicitly uses a
          # different database, an error should be raised.
        with self.assertRaises(ValueError):
            str(qs.query)
  
          # Evaluating the query shouldn't work, either
          with self.assertRaises(ValueError):
              for obj in qs:
                  pass
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/multiple_database/tests.py