diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-03-19 19:11:51 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-03-19 19:11:51 +0000 |
| commit | bc1f67a6de45fe2ebfdf69ba449295066f365419 (patch) | |
| tree | b453ce74643c64e1884f5fedfd1d3f463ad8a233 /tests/modeltests/validation | |
| parent | 6035af82d4c7905c619bccdee030bdfc1721ad0c (diff) | |
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
Diffstat (limited to 'tests/modeltests/validation')
| -rw-r--r-- | tests/modeltests/validation/models.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py index aacd041678..63f9f7a361 100644 --- a/tests/modeltests/validation/models.py +++ b/tests/modeltests/validation/models.py @@ -41,8 +41,8 @@ __test__ = {'API_TESTS':""" 23 >>> p = Person(**dict(valid_params, id='foo')) ->>> p.validate() -{'id': [u'This value must be an integer.']} +>>> p.validate()['id'] +[u'This value must be an integer.'] >>> p = Person(**dict(valid_params, id=None)) >>> p.validate() @@ -75,8 +75,8 @@ True False >>> p = Person(**dict(valid_params, is_child='foo')) ->>> p.validate() -{'is_child': [u'This value must be either True or False.']} +>>> p.validate()['is_child'] +[u'This value must be either True or False.'] >>> p = Person(**dict(valid_params, name=u'Jose')) >>> p.validate() @@ -115,8 +115,8 @@ datetime.date(2000, 5, 3) datetime.date(2000, 5, 3) >>> p = Person(**dict(valid_params, birthdate='foo')) ->>> p.validate() -{'birthdate': [u'Enter a valid date in YYYY-MM-DD format.']} +>>> p.validate()['birthdate'] +[u'Enter a valid date in YYYY-MM-DD format.'] >>> p = Person(**dict(valid_params, favorite_moment=datetime.datetime(2002, 4, 3, 13, 23))) >>> p.validate() @@ -143,11 +143,15 @@ datetime.datetime(2002, 4, 3, 0, 0) u'john@example.com' >>> p = Person(**dict(valid_params, email=22)) ->>> p.validate() -{'email': [u'Enter a valid e-mail address.']} +>>> p.validate()['email'] +[u'Enter a valid e-mail address.'] # Make sure that Date and DateTime return validation errors and don't raise Python errors. ->>> Person(name='John Doe', is_child=True, email='abc@def.com').validate() -{'favorite_moment': [u'This field is required.'], 'birthdate': [u'This field is required.']} +>>> p = Person(name='John Doe', is_child=True, email='abc@def.com') +>>> errors = p.validate() +>>> errors['favorite_moment'] +[u'This field is required.'] +>>> errors['birthdate'] +[u'This field is required.'] """} |
