          Tests that invalid page numbers result in the correct exception being
          raised.
          """
          paginator = Paginator([1, 2, 3], 2)
          self.assertRaises(InvalidPage, paginator.page, 3)
          self.assertRaises(PageNotAnInteger, paginator.validate_number, None)
          self.assertRaises(PageNotAnInteger, paginator.validate_number, 'x')
          # With no content and allow_empty_first_page=True, 1 is a valid page number
          paginator = Paginator([], 2)
          self.assertEqual(paginator.validate_number(1), 1)
  
      def test_paginate_misc_classes(self):
 
</s> remove         self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 0, False), 1, None)
        self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 1, False), 1, None)
        self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 2, False), 1, None)
 </s> add         with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 0, False), 1, None)
        with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 1, False), 1, None)
        with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 2, False), 1, None) </s> remove         self.assertRaises(InvalidPage, p.previous_page_number)
 </s> add         with self.assertRaises(InvalidPage):
            p.previous_page_number() </s> remove         self.assertRaises(TypeError, setfcn, ul, slice(0, 3, 2), 2)
 </s> add         with self.assertRaises(TypeError):
            setfcn(ul, slice(0, 3, 2), 2) </s> remove         self.assertRaises(TypeError, lambda: Author.objects.raw(query)['test'])
 </s> add         with self.assertRaises(TypeError):
            Author.objects.raw(query)['test'] </s> remove         self.assertRaises(exception, force_text, MyString())
 </s> add         with self.assertRaises(exception):
            force_text(MyString())
        with self.assertRaises(InvalidPage):
            paginator.page(3)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number(None)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number('x')
          Tests that invalid page numbers result in the correct exception being
          raised.
          """
          paginator = Paginator([1, 2, 3], 2)
        with self.assertRaises(InvalidPage):
            paginator.page(3)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number(None)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number('x')
        with self.assertRaises(InvalidPage):
            paginator.page(3)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number(None)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number('x')
        with self.assertRaises(InvalidPage):
            paginator.page(3)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number(None)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number('x')
          # With no content and allow_empty_first_page=True, 1 is a valid page number
          paginator = Paginator([], 2)
          self.assertEqual(paginator.validate_number(1), 1)
  
      def test_paginate_misc_classes(self):
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/pagination/tests.py