From 0421b2597f35e421245c689ac8f1c7f1a455dd6b Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 8 Jan 2007 18:06:22 +0000 Subject: [PATCH] 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 --- tests/modeltests/model_forms/models.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index 7ce89c61a6..399bf36bd1 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -67,8 +67,8 @@ __test__ = {'API_TESTS': """
  • The URL:
  • >>> 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': """ [] >>> 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): ...