Fixed #1781 -- Fixed unit tests to use new error message for DoesNotExist. Thanks, pb
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
71f4568613
commit
0727df90f0
|
@ -73,12 +73,12 @@ Area woman programs in Python
|
||||||
>>> Article.objects.get(id__exact=2)
|
>>> Article.objects.get(id__exact=2)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Article does not exist for {'id__exact': 2}
|
DoesNotExist: Article matching query does not exist.
|
||||||
|
|
||||||
>>> Article.objects.get(pub_date__year=2005, pub_date__month=8)
|
>>> Article.objects.get(pub_date__year=2005, pub_date__month=8)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Article does not exist for ...
|
DoesNotExist: Article matching query does not exist.
|
||||||
|
|
||||||
# Lookup by a primary key is the most common case, so Django provides a
|
# Lookup by a primary key is the most common case, so Django provides a
|
||||||
# shortcut for primary-key exact lookups.
|
# shortcut for primary-key exact lookups.
|
||||||
|
|
|
@ -44,7 +44,7 @@ Fran Bones
|
||||||
>>> Employee.objects.get(pk='foo')
|
>>> Employee.objects.get(pk='foo')
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Employee does not exist for {'pk': 'foo'}
|
DoesNotExist: Employee matching query does not exist.
|
||||||
|
|
||||||
# Use the name of the primary key, rather than pk.
|
# Use the name of the primary key, rather than pk.
|
||||||
>>> Employee.objects.get(employee_code__exact='ABC123')
|
>>> Employee.objects.get(employee_code__exact='ABC123')
|
||||||
|
|
|
@ -34,7 +34,7 @@ API_TESTS = """
|
||||||
>>> Article.objects.latest()
|
>>> Article.objects.latest()
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Article does not exist for ...
|
DoesNotExist: Article matching query does not exist.
|
||||||
|
|
||||||
# Create a couple of Articles.
|
# Create a couple of Articles.
|
||||||
>>> from datetime import datetime
|
>>> from datetime import datetime
|
||||||
|
|
|
@ -135,7 +135,7 @@ Article 6
|
||||||
>>> a5.get_next_by_pub_date()
|
>>> a5.get_next_by_pub_date()
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Article does not exist for ...
|
DoesNotExist: Article matching query does not exist.
|
||||||
>>> a6.get_next_by_pub_date()
|
>>> a6.get_next_by_pub_date()
|
||||||
Article 5
|
Article 5
|
||||||
>>> a7.get_next_by_pub_date()
|
>>> a7.get_next_by_pub_date()
|
||||||
|
|
|
@ -53,7 +53,7 @@ Demon Dogs the restaurant
|
||||||
>>> p2.restaurant
|
>>> p2.restaurant
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
DoesNotExist: Restaurant does not exist for {'place__pk': ...}
|
DoesNotExist: Restaurant matching query does not exist.
|
||||||
|
|
||||||
# Set the place using assignment notation. Because place is the primary key on Restaurant,
|
# Set the place using assignment notation. Because place is the primary key on Restaurant,
|
||||||
# the save will create a new restaurant
|
# the save will create a new restaurant
|
||||||
|
|
Loading…
Reference in New Issue