diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
| commit | ca33d307dee3cf68cc9cd2ccfae00c7ff23ea890 (patch) | |
| tree | e0f0afa392f4ab50de4a89e2a0b1b4cc53f40794 /tests/regressiontests/forms/tests.py | |
| parent | 7325fbf4ff20f9b0f21d3a1aba1abaca78a765d7 (diff) | |
queryset-refactor: Merged to [6300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/tests.py')
| -rw-r--r-- | tests/regressiontests/forms/tests.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index fef8361a14..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): ... @@ -3856,6 +3870,25 @@ u'sirrobin' <div class="errorlist"><div class="error">This field is required.</div></div> <p>Comment: <input type="text" name="comment" /></p> +################################# +# Test multipart-encoded form # +################################# + +>>> class FormWithoutFile(Form): +... username = CharField() +>>> class FormWithFile(Form): +... username = CharField() +... file = FileField() +>>> class FormWithImage(Form): +... image = ImageField() + +>>> FormWithoutFile().is_multipart() +False +>>> FormWithFile().is_multipart() +True +>>> FormWithImage().is_multipart() +True + """ __test__ = { |
