              self.check_indexes(params, 'first', first)
              self.check_indexes(params, 'last', last)
  
          # When no items and no empty first page, we should get EmptyPage error.
          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)
  
      def test_page_sequence(self):
          """
          Tests that a paginator page acts like a standard sequence.
          """
 
</s> remove         self.assertRaises(InvalidPage, paginator.page, 3)
        self.assertRaises(PageNotAnInteger, paginator.validate_number, None)
        self.assertRaises(PageNotAnInteger, paginator.validate_number, 'x')
 </s> add         with self.assertRaises(InvalidPage):
            paginator.page(3)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number(None)
        with self.assertRaises(PageNotAnInteger):
            paginator.validate_number('x') </s> remove             self.assertRaises(forms.ValidationError, fld.to_python, wkt)
 </s> add             with self.assertRaises(forms.ValidationError):
                fld.to_python(wkt) </s> remove         self.assertRaises(ValueError, parse_date, '2012-04-56')
 </s> add         with self.assertRaises(ValueError):
            parse_date('2012-04-56') </s> remove             self.assertRaises(ValueError, wkb_w._set_outdim, bad_outdim)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_outdim(bad_outdim) </s> remove         self.assertRaises(ValueError, parse_datetime, '2012-04-56T09:15:90')
 </s> add         with self.assertRaises(ValueError):
            parse_datetime('2012-04-56T09:15:90')
        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)
              self.check_indexes(params, 'first', first)
              self.check_indexes(params, 'last', last)
  
          # When no items and no empty first page, we should get EmptyPage error.
        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)
        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)
        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)
  
      def test_page_sequence(self):
          """
          Tests that a paginator page acts like a standard sequence.
          """
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