          self.assertEqual('a', f.clean('a', None))
  
      def test_charfield_with_choices_raises_error_on_invalid_choice(self):
          f = models.CharField(choices=[('a', 'A'), ('b', 'B')])
          with self.assertRaises(ValidationError):
              f.clean('not a', None)
  
      def test_enum_choices_cleans_valid_string(self):
          f = models.CharField(choices=self.Choices.choices, max_length=1)
          self.assertEqual(f.clean('c', None), 'c')
 
</s> remove         with self.assertRaises(ValidationError):
 </s> add         msg = "Value 'a' is not a valid choice."
        with self.assertRaisesMessage(ValidationError, msg): </s> remove         with self.assertRaises(ValidationError):
 </s> add         msg = 'This field cannot be null.'
        with self.assertRaisesMessage(ValidationError, msg): </s> remove         with self.assertRaises(ValidationError):
 </s> add         msg = 'This field cannot be blank.'
        with self.assertRaisesMessage(ValidationError, msg):
        msg = "Value 'not a' is not a valid choice."
        with self.assertRaisesMessage(ValidationError, msg):
          self.assertEqual('a', f.clean('a', None))
  
      def test_charfield_with_choices_raises_error_on_invalid_choice(self):
          f = models.CharField(choices=[('a', 'A'), ('b', 'B')])
        msg = "Value 'not a' is not a valid choice."
        with self.assertRaisesMessage(ValidationError, msg):
              f.clean('not a', None)
  
      def test_enum_choices_cleans_valid_string(self):
          f = models.CharField(choices=self.Choices.choices, max_length=1)
          self.assertEqual(f.clean('c', None), 'c')
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() in CharField tests. 
tests/model_fields/test_charfield.py