@@ -74,8 +74,10 @@ def assertSuccessfulRawQuery(
7474 Execute the passed query against the passed model and check the output.
7575 """
7676 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 )
7981
8082 def assertProcessed (self , model , results , orig , expected_annotations = ()):
8183 """Compare the results of a raw query against expected results."""
@@ -189,18 +191,6 @@ def test_many_to_many(self):
189191 reviewers = Reviewer .objects .all ()
190192 self .assertSuccessfulRawQuery (Reviewer , query , reviewers )
191193
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-
204194 def test_missing_fields (self ):
205195 query = [{"$project" : {"id" : 1 , "first_name" : 1 , "dob" : 1 }}]
206196 for author in Author .objects .raw_aggregate (query ):
@@ -218,7 +208,7 @@ def test_annotations(self):
218208 query = [
219209 {
220210 "$lookup" : {
221- "from" : "raw_query_book " ,
211+ "from" : "raw_query__book " ,
222212 "localField" : "_id" ,
223213 "foreignField" : "author_id" ,
224214 "as" : "books" ,
0 commit comments