diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-01-26 13:23:25 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-01-26 13:23:25 +0000 |
| commit | 98abf27535a7e0d2d481bd59fb73a48433772d8c (patch) | |
| tree | 06d9b4c1ae9f00f74bb9a6a57d95b8248ddffb8e /tests/regressiontests/forms/fields.py | |
| parent | 83cb2218bc73707f2c15a40caef97e375c4f1175 (diff) | |
queryset-refactor: Merged from trunk up to [7025].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7029 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, 30 insertions, 3 deletions
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index cff5db6fca..9216210e09 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -749,32 +749,59 @@ Traceback (most recent call last): ... ValidationError: [u'This field is required.'] +>>> f.clean('', '') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] + +>>> f.clean('', 'files/test1.pdf') +'files/test1.pdf' + >>> f.clean(None) Traceback (most recent call last): ... ValidationError: [u'This field is required.'] +>>> f.clean(None, '') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] + +>>> f.clean(None, 'files/test2.pdf') +'files/test2.pdf' + >>> f.clean({}) Traceback (most recent call last): ... ValidationError: [u'No file was submitted.'] +>>> f.clean({}, '') +Traceback (most recent call last): +... +ValidationError: [u'No file was submitted.'] + +>>> f.clean({}, 'files/test3.pdf') +'files/test3.pdf' + >>> f.clean('some content that is not a file') 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({'filename': 'name', 'content': None}) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> f.clean({'filename': 'name', 'content':''}) +>>> f.clean({'filename': 'name', 'content': ''}) Traceback (most recent call last): ... ValidationError: [u'The submitted file is empty.'] ->>> type(f.clean({'filename': 'name', 'content':'Some File Content'})) +>>> type(f.clean({'filename': 'name', 'content': 'Some File Content'})) +<class 'django.newforms.fields.UploadedFile'> + +>>> type(f.clean({'filename': 'name', 'content': 'Some File Content'}, 'files/test4.pdf')) <class 'django.newforms.fields.UploadedFile'> # URLField ################################################################## |
