Changeset 7814 for django/trunk/tests/regressiontests/forms
- Timestamp:
- 07/01/08 10:10:51 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/regressiontests/forms/error_messages.py
r7776 r7814 2 2 tests = r""" 3 3 >>> from django.newforms import * 4 >>> from django.core.files.uploadedfile import SimpleUploadedFile 4 5 5 6 # CharField ################################################################### … … 215 216 ... 216 217 ValidationError: [u'INVALID'] 217 >>> f.clean( {})218 Traceback (most recent call last): 219 ... 220 ValidationError: [u' MISSING']221 >>> f.clean( {'filename': 'name', 'content':''})218 >>> f.clean(SimpleUploadedFile('name', None)) 219 Traceback (most recent call last): 220 ... 221 ValidationError: [u'EMPTY FILE'] 222 >>> f.clean(SimpleUploadedFile('name', '')) 222 223 Traceback (most recent call last): 223 224 ... django/trunk/tests/regressiontests/forms/fields.py
r7799 r7814 3 3 >>> from django.newforms import * 4 4 >>> from django.newforms.widgets import RadioFieldRenderer 5 >>> from django.core.files.uploadedfile import SimpleUploadedFile 5 6 >>> import datetime 6 7 >>> import time … … 772 773 'files/test2.pdf' 773 774 774 >>> f.clean( {})775 Traceback (most recent call last): 776 ... 777 ValidationError: [u'No file was submitted. ']778 779 >>> f.clean( {}, '')780 Traceback (most recent call last): 781 ... 782 ValidationError: [u'No file was submitted. ']783 784 >>> f.clean( {}, 'files/test3.pdf')775 >>> f.clean(SimpleUploadedFile('', '')) 776 Traceback (most recent call last): 777 ... 778 ValidationError: [u'No file was submitted. Check the encoding type on the form.'] 779 780 >>> f.clean(SimpleUploadedFile('', ''), '') 781 Traceback (most recent call last): 782 ... 783 ValidationError: [u'No file was submitted. Check the encoding type on the form.'] 784 785 >>> f.clean(None, 'files/test3.pdf') 785 786 'files/test3.pdf' 786 787 … … 790 791 ValidationError: [u'No file was submitted. Check the encoding type on the form.'] 791 792 792 >>> f.clean( {'filename': 'name', 'content': None})793 >>> f.clean(SimpleUploadedFile('name', None)) 793 794 Traceback (most recent call last): 794 795 ... 795 796 ValidationError: [u'The submitted file is empty.'] 796 797 797 >>> f.clean( {'filename': 'name', 'content': ''})798 >>> f.clean(SimpleUploadedFile('name', '')) 798 799 Traceback (most recent call last): 799 800 ... 800 801 ValidationError: [u'The submitted file is empty.'] 801 802 802 >>> type(f.clean( {'filename': 'name', 'content': 'Some File Content'}))803 >>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'))) 803 804 <class 'django.newforms.fields.UploadedFile'> 804 805 805 >>> type(f.clean( {'filename': 'name', 'content': 'Some File Content'}, 'files/test4.pdf'))806 >>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'), 'files/test4.pdf')) 806 807 <class 'django.newforms.fields.UploadedFile'> 807 808 django/trunk/tests/regressiontests/forms/forms.py
r7693 r7814 2 2 tests = r""" 3 3 >>> from django.newforms import * 4 >>> from django.core.files.uploadedfile import SimpleUploadedFile 4 5 >>> import datetime 5 6 >>> import time … … 1466 1467 <tr><th>File1:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="file" name="file1" /></td></tr> 1467 1468 1468 >>> f = FileForm(data={}, files={'file1': {'filename': 'name', 'content':''}}, auto_id=False)1469 >>> f = FileForm(data={}, files={'file1': SimpleUploadedFile('name', '')}, auto_id=False) 1469 1470 >>> print f 1470 1471 <tr><th>File1:</th><td><ul class="errorlist"><li>The submitted file is empty.</li></ul><input type="file" name="file1" /></td></tr> … … 1474 1475 <tr><th>File1:</th><td><ul class="errorlist"><li>No file was submitted. Check the encoding type on the form.</li></ul><input type="file" name="file1" /></td></tr> 1475 1476 1476 >>> f = FileForm(data={}, files={'file1': {'filename': 'name', 'content':'some content'}}, auto_id=False)1477 >>> f = FileForm(data={}, files={'file1': SimpleUploadedFile('name', 'some content')}, auto_id=False) 1477 1478 >>> print f 1478 1479 <tr><th>File1:</th><td><input type="file" name="file1" /></td></tr>
