Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3252 -- Fixed bugs in model_forms unit tests, related to recen…

…t newforms clean_data change. Thanks for the patch, mir@noris.de

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0421b2597f35e421245c689ac8f1c7f1a455dd6b 1 parent 3b4d6b4
Adrian Holovaty authored January 08, 2007

Showing 1 changed file with 9 additions and 6 deletions. Show diff stats Hide diff stats

  1. 15  tests/modeltests/model_forms/models.py
15  tests/modeltests/model_forms/models.py
@@ -67,8 +67,8 @@ def __str__(self):
67 67
 <li>The URL: <input type="text" name="url" maxlength="40" /></li>
68 68
 
69 69
 >>> f = CategoryForm({'name': 'Entertainment', 'url': 'entertainment'})
70  
->>> f.errors
71  
-{}
  70
+>>> f.is_valid()
  71
+True
72 72
 >>> f.clean_data
73 73
 {'url': u'entertainment', 'name': u'Entertainment'}
74 74
 >>> obj = f.create()
@@ -78,8 +78,8 @@ def __str__(self):
78 78
 [<Category: Entertainment>]
79 79
 
80 80
 >>> f = CategoryForm({'name': "It's a test", 'url': 'test'})
81  
->>> f.errors
82  
-{}
  81
+>>> f.is_valid()
  82
+True
83 83
 >>> f.clean_data
84 84
 {'url': u'test', 'name': u"It's a test"}
85 85
 >>> obj = f.create()
@@ -91,8 +91,8 @@ def __str__(self):
91 91
 If you call create() with save=False, then it will return an object that hasn't
92 92
 yet been saved. In this case, it's up to you to save it.
93 93
 >>> f = CategoryForm({'name': 'Third test', 'url': 'third'})
94  
->>> f.errors
95  
-{}
  94
+>>> f.is_valid()
  95
+True
96 96
 >>> f.clean_data
97 97
 {'url': u'third', 'name': u'Third test'}
98 98
 >>> obj = f.create(save=False)
@@ -109,6 +109,9 @@ def __str__(self):
109 109
 >>> f.errors
110 110
 {'name': [u'This field is required.']}
111 111
 >>> f.clean_data
  112
+Traceback (most recent call last):
  113
+...
  114
+AttributeError: 'CategoryForm' object has no attribute 'clean_data'
112 115
 >>> f.create()
113 116
 Traceback (most recent call last):
114 117
 ...

0 notes on commit 0421b25

Please sign in to comment.
Something went wrong with that request. Please try again.