Commits

adr...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed c1d6cf8

Fixed #3252 -- Fixed bugs in model_forms unit tests, related to recent newforms clean_data change. Thanks for the patch, mir@noris.de

  • Participants
  • Parent commits ba4ec24

Comments (0)

Files changed (1)

File tests/modeltests/model_forms/models.py

 <li>The URL: <input type="text" name="url" maxlength="40" /></li>
 
 >>> f = CategoryForm({'name': 'Entertainment', 'url': 'entertainment'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
 >>> f.clean_data
 {'url': u'entertainment', 'name': u'Entertainment'}
 >>> obj = f.create()
 [<Category: Entertainment>]
 
 >>> f = CategoryForm({'name': "It's a test", 'url': 'test'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
 >>> f.clean_data
 {'url': u'test', 'name': u"It's a test"}
 >>> obj = f.create()
 If you call create() with save=False, then it will return an object that hasn't
 yet been saved. In this case, it's up to you to save it.
 >>> f = CategoryForm({'name': 'Third test', 'url': 'third'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
 >>> f.clean_data
 {'url': u'third', 'name': u'Third test'}
 >>> obj = f.create(save=False)
 >>> f.errors
 {'name': [u'This field is required.']}
 >>> f.clean_data
+Traceback (most recent call last):
+...
+AttributeError: 'CategoryForm' object has no attribute 'clean_data'
 >>> f.create()
 Traceback (most recent call last):
 ...