From bc1f67a6de45fe2ebfdf69ba449295066f365419 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Wed, 19 Mar 2008 19:11:51 +0000 Subject: Replaced dict reprs in tests with explicit looks at each key. This should fix many spurious test failures on other VMs (first noticed on Jython). git-svn-id: http://code.djangoproject.com/svn/django/trunk@7322 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/model_forms/models.py | 36 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'tests/modeltests/model_forms') diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index c480899f84..a3c3ba2142 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -234,8 +234,12 @@ We can also subclass the Meta inner class to change the fields list. >>> f = CategoryForm({'name': 'Entertainment', 'slug': 'entertainment', 'url': 'entertainment'}) >>> f.is_valid() True ->>> f.cleaned_data -{'url': u'entertainment', 'name': u'Entertainment', 'slug': u'entertainment'} +>>> f.cleaned_data['url'] +u'entertainment' +>>> f.cleaned_data['name'] +u'Entertainment' +>>> f.cleaned_data['slug'] +u'entertainment' >>> obj = f.save() >>> obj @@ -245,8 +249,12 @@ True >>> f = CategoryForm({'name': "It's a test", 'slug': 'its-test', 'url': 'test'}) >>> f.is_valid() True ->>> f.cleaned_data -{'url': u'test', 'name': u"It's a test", 'slug': u'its-test'} +>>> f.cleaned_data['url'] +u'test' +>>> f.cleaned_data['name'] +u"It's a test" +>>> f.cleaned_data['slug'] +u'its-test' >>> obj = f.save() >>> obj @@ -259,8 +267,12 @@ save() on the resulting model instance. >>> f = CategoryForm({'name': 'Third test', 'slug': 'third-test', 'url': 'third'}) >>> f.is_valid() True ->>> f.cleaned_data -{'url': u'third', 'name': u'Third test', 'slug': u'third-test'} +>>> f.cleaned_data['url'] +u'third' +>>> f.cleaned_data['name'] +u'Third test' +>>> f.cleaned_data['slug'] +u'third-test' >>> obj = f.save(commit=False) >>> obj @@ -272,8 +284,10 @@ True If you call save() with invalid data, you'll get a ValueError. >>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'}) ->>> f.errors -{'name': [u'This field is required.'], 'slug': [u'This field is required.']} +>>> f.errors['name'] +[u'This field is required.'] +>>> f.errors['slug'] +[u'This field is required.'] >>> f.cleaned_data Traceback (most recent call last): ... @@ -739,8 +753,10 @@ ValidationError: [u'Select a valid choice. 4 is not one of the available choices >>> f = PhoneNumberForm({'phone': '(312) 555-1212', 'description': 'Assistance'}) >>> f.is_valid() True ->>> f.cleaned_data -{'phone': u'312-555-1212', 'description': u'Assistance'} +>>> f.cleaned_data['phone'] +u'312-555-1212' +>>> f.cleaned_data['description'] +u'Assistance' # FileField ################################################################### -- cgit v1.3