@@ -74,8 +74,10 @@ def assertSuccessfulRawQuery(
74
74
Execute the passed query against the passed model and check the output.
75
75
"""
76
76
results = list (model .objects .raw_aggregate (query ))
77
- self .assertProcessed (model , results , expected_results , expected_annotations )
78
- self .assertAnnotations (results , expected_annotations )
77
+ expected_results = list (expected_results )
78
+ with self .assertNumQueries (0 ):
79
+ self .assertProcessed (model , results , expected_results , expected_annotations )
80
+ self .assertAnnotations (results , expected_annotations )
79
81
80
82
def assertProcessed (self , model , results , orig , expected_annotations = ()):
81
83
"""Compare the results of a raw query against expected results."""
@@ -189,18 +191,6 @@ def test_many_to_many(self):
189
191
reviewers = Reviewer .objects .all ()
190
192
self .assertSuccessfulRawQuery (Reviewer , query , reviewers )
191
193
192
- def test_extra_projections (self ):
193
- """Extra projections are ignored."""
194
- query = [
195
- {
196
- "$project" : {
197
- "something" : "else" ,
198
- }
199
- }
200
- ]
201
- authors = Author .objects .all ()
202
- self .assertSuccessfulRawQuery (Author , query , authors )
203
-
204
194
def test_missing_fields (self ):
205
195
query = [{"$project" : {"id" : 1 , "first_name" : 1 , "dob" : 1 }}]
206
196
for author in Author .objects .raw_aggregate (query ):
@@ -218,7 +208,7 @@ def test_annotations(self):
218
208
query = [
219
209
{
220
210
"$lookup" : {
221
- "from" : "raw_query_book " ,
211
+ "from" : "raw_query__book " ,
222
212
"localField" : "_id" ,
223
213
"foreignField" : "author_id" ,
224
214
"as" : "books" ,
0 commit comments