diff options
| author | Justin Bronn <jbronn@gmail.com> | 2008-07-04 20:16:22 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2008-07-04 20:16:22 +0000 |
| commit | bc3d6b49089ef0ea7d174eb383b1019b6a4a061a (patch) | |
| tree | b95728880e8a968ae6a921a21cec501f6a278d08 /tests/regressiontests/forms/fields.py | |
| parent | aef8a8305d2190b00386b8b1603deb03a2949f5b (diff) | |
gis: Merged revisions 7772-7808,7811-7814,7816-7823,7826-7829,7831-7833,7835 via svnmerge from trunk. Modified `GeoWhereNode` accordingly for changes in r7835.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7836 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/fields.py')
| -rw-r--r-- | tests/regressiontests/forms/fields.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index f3b6a96a1e..4725c3ecf3 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -2,6 +2,7 @@ tests = r""" >>> from django.newforms import * >>> from django.newforms.widgets import RadioFieldRenderer +>>> from django.core.files.uploadedfile import SimpleUploadedFile >>> import datetime >>> import time >>> import re @@ -770,17 +771,17 @@ ValidationError: [u'This field is required.'] >>> f.clean(None, 'files/test2.pdf') 'files/test2.pdf' ->>> f.clean({}) +>>> f.clean(SimpleUploadedFile('', '')) Traceback (most recent call last): ... -ValidationError: [u'No file was submitted.'] +ValidationError: [u'No file was submitted. Check the encoding type on the form.'] ->>> f.clean({}, '') +>>> f.clean(SimpleUploadedFile('', ''), '') Traceback (most recent call last): ... -ValidationError: [u'No file was submitted.'] +ValidationError: [u'No file was submitted. Check the encoding type on the form.'] ->>> f.clean({}, 'files/test3.pdf') +>>> f.clean(None, 'files/test3.pdf') 'files/test3.pdf' >>> f.clean('some content that is not a file') @@ -788,20 +789,20 @@ Traceback (most recent call last): ... ValidationError: [u'No file was submitted. Check the encoding type on the form.'] ->>> f.clean({'filename': 'name', 'content': None}) +>>> f.clean(SimpleUploadedFile('name', None)) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> f.clean({'filename': 'name', 'content': ''}) +>>> f.clean(SimpleUploadedFile('name', '')) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> type(f.clean({'filename': 'name', 'content': 'Some File Content'})) +>>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'))) <class 'django.newforms.fields.UploadedFile'> ->>> type(f.clean({'filename': 'name', 'content': 'Some File Content'}, 'files/test4.pdf')) +>>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'), 'files/test4.pdf')) <class 'django.newforms.fields.UploadedFile'> # URLField ################################################################## @@ -887,7 +888,7 @@ u'http://www.google.com' Traceback (most recent call last): ... ValidationError: [u'Enter a valid URL.'] ->>> f.clean('http://www.jfoiwjfoi23jfoijoaijfoiwjofiwjefewl.com') # bad domain +>>> f.clean('http://www.broken.djangoproject.com') # bad domain Traceback (most recent call last): ... ValidationError: [u'This URL appears to be a broken link.'] @@ -937,18 +938,24 @@ ValidationError: [u'This field is required.'] >>> f.clean(True) True >>> f.clean(False) -False +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] >>> f.clean(1) True >>> f.clean(0) -False +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] >>> f.clean('Django rocks') True >>> f.clean('True') True >>> f.clean('False') -False +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] >>> f = BooleanField(required=False) >>> f.clean('') |
