@@ -85,31 +85,33 @@ def setUpTestData(cls):
8585
8686 def test_none_filter_nullable_json_exact (self ):
8787 with self .assertNumQueries (1 ) as ctx :
88- self .assertQuerySetEqual (
89- NullableJSONModel .objects .filter (value = None ),
90- self .null_objs [:- 1 ],
91- )
88+ list (NullableJSONModel .objects .filter (value = None ))
9289 self .assertAggregateQuery (
9390 ctx .captured_queries [0 ]["sql" ],
9491 "lookup__nullablejsonmodel" ,
9592 [{"$match" : {"$and" : [{"value" : {"$exists" : True }}, {"value" : None }]}}],
9693 )
94+ self .assertQuerySetEqual (
95+ NullableJSONModel .objects .filter (value = None ),
96+ self .null_objs [:- 1 ],
97+ )
9798
9899 def test_none_filter_nullable_json_in (self ):
99100 with self .assertNumQueries (1 ) as ctx :
100- self .assertQuerySetEqual (
101- NullableJSONModel .objects .filter (value__in = [None ]),
102- self .null_objs [:- 1 ],
103- )
101+ list (NullableJSONModel .objects .filter (value__in = [None ]))
104102 self .assertAggregateQuery (
105103 ctx .captured_queries [0 ]["sql" ],
106104 "lookup__nullablejsonmodel" ,
107105 [{"$match" : {"$and" : [{"value" : {"$exists" : True }}, {"value" : {"$in" : [None ]}}]}}],
108106 )
107+ self .assertQuerySetEqual (
108+ NullableJSONModel .objects .filter (value__in = [None ]),
109+ self .null_objs [:- 1 ],
110+ )
109111
110112 def test_none_filter_binary_operator_exact (self ):
111113 with self .assertNumQueries (1 ) as ctx :
112- self . assertQuerySetEqual (Book .objects .filter (title = None ), [] )
114+ list (Book .objects .filter (title = None ))
113115 self .assertAggregateQuery (
114116 ctx .captured_queries [0 ]["sql" ],
115117 "lookup__book" ,
@@ -124,10 +126,11 @@ def test_none_filter_binary_operator_exact(self):
124126 }
125127 ],
126128 )
129+ self .assertQuerySetEqual (Book .objects .filter (title = None ), [])
127130
128131 def test_none_filter_binary_operator_in (self ):
129132 with self .assertNumQueries (1 ) as ctx :
130- self . assertQuerySetEqual (Book .objects .filter (title__in = [None ]), [] )
133+ list (Book .objects .filter (title__in = [None ]))
131134 self .assertAggregateQuery (
132135 ctx .captured_queries [0 ]["sql" ],
133136 "lookup__book" ,
@@ -142,3 +145,4 @@ def test_none_filter_binary_operator_in(self):
142145 }
143146 ],
144147 )
148+ self .assertQuerySetEqual (Book .objects .filter (title__in = [None ]), [])
0 commit comments