Django

Code

Ticket #4130: patch_field_choices_tests.txt

File patch_field_choices_tests.txt, 3.3 kB (added by ned@nedbatchelder, 2 years ago)

A second patch, fixing the tests.

Line 
1 Index: modeltests/reverse_lookup/models.py
2 ===================================================================
3 --- modeltests/reverse_lookup/models.py (revision 5061)
4 +++ modeltests/reverse_lookup/models.py (working copy)
5 @@ -55,5 +55,5 @@
6  >>> Poll.objects.get(choice__name__exact="This is the answer")
7  Traceback (most recent call last):
8      ...
9 -TypeError: Cannot resolve keyword 'choice' into field
10 +TypeError: Cannot resolve keyword 'choice' into field, choices are: poll_choice, related_choice, id, question, creator
11  """}
12 Index: modeltests/lookup/models.py
13 ===================================================================
14 --- modeltests/lookup/models.py (revision 5061)
15 +++ modeltests/lookup/models.py (working copy)
16 @@ -223,11 +223,11 @@
17  >>> Article.objects.filter(pub_date_year='2005').count()
18  Traceback (most recent call last):
19      ...
20 -TypeError: Cannot resolve keyword 'pub_date_year' into field
21 +TypeError: Cannot resolve keyword 'pub_date_year' into field, choices are: id, headline, pub_date
22  
23  >>> Article.objects.filter(headline__starts='Article')
24  Traceback (most recent call last):
25      ...
26 -TypeError: Cannot resolve keyword 'headline__starts' into field
27 +TypeError: Cannot resolve keyword 'headline__starts' into field, choices are: id, headline, pub_date
28  
29  """}
30 Index: modeltests/many_to_one/models.py
31 ===================================================================
32 --- modeltests/many_to_one/models.py    (revision 5061)
33 +++ modeltests/many_to_one/models.py    (working copy)
34 @@ -174,13 +174,13 @@
35  >>> Article.objects.filter(reporter_id__exact=1)
36  Traceback (most recent call last):
37      ...
38 -TypeError: Cannot resolve keyword 'reporter_id' into field
39 +TypeError: Cannot resolve keyword 'reporter_id' into field, choices are: id, headline, pub_date, reporter
40  
41  # You need to specify a comparison clause
42  >>> Article.objects.filter(reporter_id=1)
43  Traceback (most recent call last):
44      ...
45 -TypeError: Cannot resolve keyword 'reporter_id' into field
46 +TypeError: Cannot resolve keyword 'reporter_id' into field, choices are: id, headline, pub_date, reporter
47  
48  # You can also instantiate an Article by passing
49  # the Reporter's ID instead of a Reporter object.
50 Index: modeltests/custom_columns/models.py
51 ===================================================================
52 --- modeltests/custom_columns/models.py (revision 5061)
53 +++ modeltests/custom_columns/models.py (working copy)
54 @@ -71,7 +71,7 @@
55  >>> Author.objects.filter(firstname__exact='John')
56  Traceback (most recent call last):
57      ...
58 -TypeError: Cannot resolve keyword 'firstname' into field
59 +TypeError: Cannot resolve keyword 'firstname' into field, choices are: article, id, first_name, last_name
60  
61  >>> a = Author.objects.get(last_name__exact='Smith')
62  >>> a.first_name
63 Index: regressiontests/null_queries/models.py
64 ===================================================================
65 --- regressiontests/null_queries/models.py      (revision 5061)
66 +++ regressiontests/null_queries/models.py      (working copy)
67 @@ -32,7 +32,7 @@
68  >>> Choice.objects.filter(foo__exact=None)
69  Traceback (most recent call last):
70  ...
71 -TypeError: Cannot resolve keyword 'foo' into field
72 +TypeError: Cannot resolve keyword 'foo' into field, choices are: id, poll, choice
73  
74  # Can't use None on anything other than __exact
75  >>> Choice.objects.filter(id__gt=None)