summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms/tests.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-01-04 06:25:53 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-01-04 06:25:53 +0000
commitb1f6b376c0593171f2782472574384b121e65de0 (patch)
tree16fffc34d45f8538b22bd5215e662471a02f241b /tests/regressiontests/forms/tests.py
parentddb9b7d57a1da6b8715a62376cbb8605e6b2351b (diff)
newforms: Changed Form so that clean_data only exists if a Form is valid. Thanks for the idea, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4284 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/tests.py')
-rw-r--r--tests/regressiontests/forms/tests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index 0852fbcf0e..6e2f898645 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -1544,6 +1544,10 @@ Empty dictionaries are valid, too.
{'first_name': [u'This field is required.'], 'last_name': [u'This field is required.'], 'birthday': [u'This field is required.']}
>>> p.is_valid()
False
+>>> p.clean_data
+Traceback (most recent call last):
+...
+AttributeError: 'birthday' object has no attribute 'clean_data'
>>> print p
<tr><th><label for="id_first_name">First name:</label></th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="first_name" id="id_first_name" /></td></tr>
<tr><th><label for="id_last_name">Last name:</label></th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="last_name" id="id_last_name" /></td></tr>
@@ -1572,6 +1576,10 @@ Form.is_valid() will return False.
{}
>>> p.is_valid()
False
+>>> p.clean_data
+Traceback (most recent call last):
+...
+AttributeError: 'birthday' object has no attribute 'clean_data'
>>> print p
<tr><th><label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" id="id_first_name" /></td></tr>
<tr><th><label for="id_last_name">Last name:</label></th><td><input type="text" name="last_name" id="id_last_name" /></td></tr>
@@ -1611,8 +1619,9 @@ u'<ul class="errorlist"><li>first_name<ul class="errorlist"><li>This field is re
* birthday
* This field is required.
>>> p.clean_data
->>> repr(p.clean_data)
-'None'
+Traceback (most recent call last):
+...
+AttributeError: 'birthday' object has no attribute 'clean_data'
>>> p['first_name'].errors
[u'This field is required.']
>>> p['first_name'].errors.as_ul()