  
  class ValidationTest(test.SimpleTestCase):
      def test_charfield_raises_error_on_empty_string(self):
          f = models.CharField()
          self.assertRaises(ValidationError, f.clean, "", None)
  
      def test_charfield_cleans_empty_string_when_blank_true(self):
          f = models.CharField(blank=True)
          self.assertEqual('', f.clean('', 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, 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, "a", None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean("a", None) </s> remove         self.assertRaises(ValidationError, f.clean, '0', None)
 </s> add         with self.assertRaises(ValidationError):
            f.clean('0', None)
        with self.assertRaises(ValidationError):
            f.clean("", None)
  
  class ValidationTest(test.SimpleTestCase):
      def test_charfield_raises_error_on_empty_string(self):
          f = models.CharField()
        with self.assertRaises(ValidationError):
            f.clean("", None)
  
      def test_charfield_cleans_empty_string_when_blank_true(self):
          f = models.CharField(blank=True)
          self.assertEqual('', f.clean('', 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