Fixed #3252 -- Fixed bugs in model_forms unit tests, related to recent 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
This commit is contained in:
Adrian Holovaty 2007-01-08 18:06:22 +00:00
parent 3b4d6b4dc1
commit 0421b2597f
1 changed files with 9 additions and 6 deletions

View File

@ -67,8 +67,8 @@ __test__ = {'API_TESTS': """
<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()
@ -78,8 +78,8 @@ __test__ = {'API_TESTS': """
[<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()
@ -91,8 +91,8 @@ __test__ = {'API_TESTS': """
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)
@ -109,6 +109,9 @@ If you call create() with invalid data, you'll get a ValueError.
>>> 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):
...