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
This commit is contained in:
Jacob Kaplan-Moss 2008-03-19 19:11:51 +00:00
parent 6035af82d4
commit bc1f67a6de
7 changed files with 179 additions and 84 deletions

View file

@ -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.']
"""}