summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-02-22 15:02:45 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-02-22 15:02:45 +0000
commit8b415e7299aebd0c4109925d8fe366734810413a (patch)
treef4ad5dc2b7b4d85cc7e2a6d1106e681a9278faf9 /tests
parent9ee2d5c646bc078aa336cb0b12d6f28d6bfbb436 (diff)
[1.1.X] Fixed #7777 -- Added validation handling for NaN, Inf and -Inf in DecimalFields. Thanks to thebitguru for the patch.
Backport of r12490 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12491 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/fields.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py
index 9d407d9ea7..48da0f9e1d 100644
--- a/tests/regressiontests/forms/fields.py
+++ b/tests/regressiontests/forms/fields.py
@@ -320,6 +320,18 @@ True
True
>>> f.clean(Decimal('3.14')) == Decimal("3.14")
True
+>>> f.clean('NaN')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a number.']
+>>> f.clean('Inf')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a number.']
+>>> f.clean('-Inf')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a number.']
>>> f.clean('a')
Traceback (most recent call last):
...