summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms/tests.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-09-10 02:29:42 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-09-10 02:29:42 +0000
commit52578a1d1d06195bf0d4700ba44247833290ffef (patch)
tree96641354a109687a1fcc7a0abd860b6eed0df665 /tests/regressiontests/forms/tests.py
parentb5aa61a325136d6484ccbfc8a0efd98e8aaa964a (diff)
newforms-admin: Merged to [6081]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/tests.py')
-rw-r--r--tests/regressiontests/forms/tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index d2da38f1c8..0284449a59 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -1169,6 +1169,31 @@ ValidationError: [u'Ensure that there are no more than 2 decimal places.']
Traceback (most recent call last):
...
ValidationError: [u'Ensure that there are no more than 2 digits before the decimal point.']
+>>> f.clean('-12.34')
+Decimal("-12.34")
+>>> f.clean('-123.45')
+Traceback (most recent call last):
+...
+ValidationError: [u'Ensure that there are no more than 4 digits in total.']
+>>> f.clean('-.12')
+Decimal("-0.12")
+>>> f.clean('-00.12')
+Decimal("-0.12")
+>>> f.clean('-000.12')
+Decimal("-0.12")
+>>> f.clean('-000.123')
+Traceback (most recent call last):
+...
+ValidationError: [u'Ensure that there are no more than 2 decimal places.']
+>>> f.clean('-000.1234')
+Traceback (most recent call last):
+...
+ValidationError: [u'Ensure that there are no more than 4 digits in total.']
+>>> f.clean('--0.12')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a number.']
+
>>> f = DecimalField(max_digits=4, decimal_places=2, required=False)
>>> f.clean('')