          self.assertEqual(2, f.clean('2', None))
  
      def test_integerfield_raises_error_on_invalid_intput(self):
          f = models.IntegerField()
          self.assertRaises(ValidationError, f.clean, "a", None)
  
      def test_charfield_with_choices_cleans_valid_choice(self):
          f = models.CharField(max_length=1,
                               choices=[('a', 'A'), ('b', 'B')])
          self.assertEqual('a', f.clean('a', None))
 
</s> remove         self.assertRaises(ValidationError, f.clean, "not a", None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean("not a", None) </s> remove         self.assertRaises(ValidationError, f.clean, None, None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean(None, None) </s> remove         self.assertRaises(ValidationError, f.clean, None, None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean(None, None) </s> remove         self.assertRaises(ValidationError, f.clean, None, None)
        self.assertRaises(ValidationError, f.clean, '', None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean(None, None)
        with self.assertRaises(ValidationError):
            f.clean('', None) </s> remove         self.assertRaises(ValidationError, f.clean, "", None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean("", None)
        with self.assertRaises(ValidationError):
            f.clean("a", None)
          self.assertEqual(2, f.clean('2', None))
  
      def test_integerfield_raises_error_on_invalid_intput(self):
          f = models.IntegerField()
        with self.assertRaises(ValidationError):
            f.clean("a", None)
  
      def test_charfield_with_choices_cleans_valid_choice(self):
          f = models.CharField(max_length=1,
                               choices=[('a', 'A'), ('b', 'B')])
          self.assertEqual('a', f.clean('a', None))
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/model_fields/tests.py