Permalink
Browse files

going stable

  • Loading branch information...
sorl committed Nov 27, 2011
1 parent 05c60ff commit 5d466c3a9d76e0a53e7a1e509f68b4032a2b6f87
Showing with 19 additions and 8 deletions.
  1. +2 −2 setup.py
  2. +1 −1 stringfield/base.py
  3. +15 −3 stringfield/tests.py
  4. +1 −2 tests/runtests.py
View
@@ -10,7 +10,7 @@ def run(self):
setup(
name='django-stringfield',
- version='0.2.3',
+ version='0.3.0',
description='Better string field for Django.',
long_description=open('README.rst').read(),
author='Mikko Hellsing',
@@ -20,7 +20,7 @@ def run(self):
packages=find_packages(exclude=['tests', 'tests.*']),
zip_safe=False,
classifiers=[
- 'Development Status :: 3 - Alpha',
+ 'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
View
@@ -50,7 +50,7 @@ def db_type(self, connection=None):
def south_field_triple(self):
from south.modelsinspector import introspector
- name = '%s.%s' % (self.__class__.__module__ , self.__class__.__name__)
+ name = 'stringfield.StringField'
args, kwargs = introspector(self)
kwargs.pop('max_length', None)
return name, args, kwargs
View
@@ -6,11 +6,11 @@
class ValidationTest(TestCase):
def test_stringfield_raises_error_on_empty_string(self):
f = StringField()
- self.assertEqual('', f.clean('', None))
+ self.assertRaises(ValidationError, f.clean, "", None)
def test_stringfield_cleans_empty_string_when_blank_true(self):
- f = StringField(blank=False)
- self.assertRaises(ValidationError, f.clean, "", None)
+ f = StringField(blank=True)
+ self.assertEqual('', f.clean('', None))
def test_stringfield_with_choices_cleans_valid_choice(self):
f = StringField(max_length=1, choices=[('a','A'), ('b','B')])
@@ -24,3 +24,15 @@ def test_stringfield_raises_error_on_empty_input(self):
f = StringField(null=False)
self.assertRaises(ValidationError, f.clean, None, None)
+
+class FormValidationTest(TestCase):
+ def test_stringfield_501(self):
+ f = StringField().formfield()
+ value = ''.join('x' for j in xrange(0, 501))
+ self.assertRaises(ValidationError, f.clean, value)
+
+ def test_stringfield_500(self):
+ f = StringField().formfield()
+ value = ''.join('x' for j in xrange(0, 500))
+ self.assertEqual(value, f.clean(value))
+
View
@@ -9,8 +9,7 @@
def runtests(test_labels=None, verbosity=1, interactive=True, failfast=True):
here = abspath(dirname(__file__))
root = pjoin(here, os.pardir)
- sys.path.append(root)
- sys.path.append(here)
+ sys.path[0:0] = [root, here]
labels = ['stringfield', 'stringfield_tests']
test_labels = test_labels or labels
if not settings.configured:

0 comments on commit 5d466c3

Please sign in to comment.