Commits

Tim Savage committed 6eff1da

Fixed import bug in django_extras.forms, added tests to prevent bug in future. Bumped beta number

Comments (0)

Files changed (6)

django_extras/__init__.py

-VERSION = (0, 2, 3, 'beta', 0)
+VERSION = (0, 2, 3, 'beta', 1)
 
 def get_version():
     # Don't litter django_extras/__init__.py with all the get_version stuff.

django_extras/forms/__init__.py

 from fields import *
-from widgets import *

django_extras/forms/fields.py

     """
     Form field that provides input for color picker
     """
-    default_validators = [ validators.validate_color ]
-
     def __init__(self, allow_alpha=False, *args, **kwargs):
         super(ColorField, self).__init__(*args, **kwargs)
         self.allow_alpha = allow_alpha

django_extras/tests/__init__.py

 from django_extras.tests.contrib.auth import *
 from django_extras.tests.core.types import *
 from django_extras.tests.core.validators import *
+from django_extras.tests.forms.fields import *

django_extras/tests/forms/__init__.py

Empty file added.

django_extras/tests/forms/fields.py

+from django import test
+from django_extras.forms import fields
+from django_extras.core import validators
+
+class ColorFieldTestCase(test.TestCase):
+    def test_check_validator_no_alpha(self):
+        target = fields.ColorField()
+        self.assertIn(validators.validate_color, target.validators)
+
+    def test_check_validator_with_alpha(self):
+        target = fields.ColorField(allow_alpha=True)
+        self.assertIn(validators.validate_alpha_color, target.validators)