

@patch('django.db.models.CharField.check')
def test_check(self, charfield_check):
    test_apps = Apps()
    charfield_check.side_effect = list
    self.assertEqual(self.field.check(), [])
    self.assertEqual(self.field_with_colors.check(), [])

    class ColorsTypeSystemCheckTestModel(models.Model):
        color = RGBColorField(colors='#333,#ff00FF')

        class Meta():
            apps = test_apps
            app_label = 'colorful'
    self.assertEqual(ColorsTypeSystemCheckTestModel.check(), [Error('colors is not iterable', hint='Define the colors param as list of strings.', obj=ColorsTypeSystemCheckTestModel._meta.get_field('color'), id='colorful.E001')])

    class ColorsItemSystemCheckTestModel(models.Model):
        color = RGBColorField(colors=['#'])

        class Meta():
            apps = test_apps
            app_label = 'colorful'
    self.assertEqual(ColorsItemSystemCheckTestModel.check(), [Error('colors item validation error', hint='Each item of the colors param must be a valid color string itself.', obj=ColorsItemSystemCheckTestModel._meta.get_field('color'), id='colorful.E002')])

dataset/ETHPy150Open charettes/django-colorful/tests/tests.py TestRBGColorField.test_check/original