      def test_localized_dateTimeField(self):
          "Localized DateTimeFields in a non-localized environment act as unlocalized widgets"
          f = forms.DateTimeField()
          # Parse a date in an unaccepted format; get an error
          self.assertRaises(forms.ValidationError, f.clean, '13:30:05 21.12.2010')
  
          # Parse a date in a valid format, get a parsed result
          result = f.clean('2010-12-21 13:30:05')
          self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
  
 
</s> remove         self.assertRaises(forms.ValidationError, f.clean, '2010-12-21 13:30:05')
 </s> add         with self.assertRaises(forms.ValidationError):
            f.clean('2010-12-21 13:30:05') </s> remove         self.assertRaises(forms.ValidationError, f.clean, '2010-12-21 13:30:05')
 </s> add         with self.assertRaises(forms.ValidationError):
            f.clean('2010-12-21 13:30:05') </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(ValueError, Country.objects.filter, mpoly__relate=(23, 'foo'))
 </s> add         with self.assertRaises(ValueError):
            Country.objects.filter(mpoly__relate=(23, 'foo')) </s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend()
        with self.assertRaises(forms.ValidationError):
            f.clean('13:30:05 21.12.2010')
      def test_localized_dateTimeField(self):
          "Localized DateTimeFields in a non-localized environment act as unlocalized widgets"
          f = forms.DateTimeField()
          # Parse a date in an unaccepted format; get an error
        with self.assertRaises(forms.ValidationError):
            f.clean('13:30:05 21.12.2010')
  
          # Parse a date in a valid format, get a parsed result
          result = f.clean('2010-12-21 13:30:05')
          self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
  
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/forms_tests/tests/test_input_formats.py