      def test_assert_num_queries(self):
          def test_func():
              raise ValueError
  
          self.assertRaises(ValueError, self.assertNumQueries, 2, test_func)
  
      def test_assert_num_queries_with_client(self):
          person = Person.objects.create(name='test')
  
          self.assertNumQueries(
 
</s> remove         self.assertRaises(ValueError, Author.objects.annotate, age=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(age=Avg('friends__age')) </s> remove         self.assertRaises(TypeError, setfcn, ul, 2, 'hello')
        self.assertRaises(TypeError, setfcn, ul, slice(0, 3, 2), ('hello', 'goodbye'))
 </s> add         with self.assertRaises(TypeError):
            setfcn(ul, 2, 'hello')
        with self.assertRaises(TypeError):
            setfcn(ul, slice(0, 3, 2), ('hello', 'goodbye')) </s> remove         self.assertRaises(ValueError, Author.objects.annotate, book_contact_set=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(book_contact_set=Avg('friends__age')) </s> remove         self.assertRaises(ValueError, indexfcn, ul, 40)
        self.assertRaises(ValueError, removefcn, ul, 40)
 </s> add         with self.assertRaises(ValueError):
            indexfcn(ul, 40)
        with self.assertRaises(ValueError):
            removefcn(ul, 40) </s> remove             self.assertRaises(TypeError, State.objects.reverse_geom)
 </s> add             with self.assertRaises(TypeError):
                State.objects.reverse_geom()
        with self.assertRaises(ValueError):
            self.assertNumQueries(2, test_func)
      def test_assert_num_queries(self):
          def test_func():
              raise ValueError
  
        with self.assertRaises(ValueError):
            self.assertNumQueries(2, test_func)
  
      def test_assert_num_queries_with_client(self):
          person = Person.objects.create(name='test')
  
          self.assertNumQueries(
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/test_utils/tests.py