diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-15 11:45:19 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-15 11:45:19 +0000 |
| commit | 885db3cb793ac1a7c269a67b5739dfc4dbe6214d (patch) | |
| tree | d9eee121e9b5f63153cb570c7bd14746c360d449 /tests/regressiontests/forms | |
| parent | 7ca1a04633a7516df3610ff97a83d8850219622d (diff) | |
Fixed #5355 -- Fixed data cleaning for DecimalField.
In passing, fixed a problem with cleaning in IntegerField.
Includes tests from PhiR.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6282 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
| -rw-r--r-- | tests/regressiontests/forms/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index b85897897f..72033a4e60 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -961,6 +961,12 @@ True Traceback (most recent call last): ... ValidationError: [u'Enter a whole number.'] +>>> f.clean(42) +42 +>>> f.clean(3.14) +Traceback (most recent call last): +... +ValidationError: [u'Enter a whole number.'] >>> f.clean('1 ') 1 >>> f.clean(' 1') @@ -1084,6 +1090,10 @@ True 23.0 >>> f.clean('3.14') 3.1400000000000001 +>>> f.clean(3.14) +3.1400000000000001 +>>> f.clean(42) +42.0 >>> f.clean('a') Traceback (most recent call last): ... @@ -1142,6 +1152,10 @@ True Decimal("23") >>> f.clean('3.14') Decimal("3.14") +>>> f.clean(3.14) +Decimal("3.14") +>>> f.clean(Decimal('3.14')) +Decimal("3.14") >>> f.clean('a') Traceback (most recent call last): ... |
