@@ -85,31 +85,33 @@ def setUpTestData(cls):
85
85
86
86
def test_none_filter_nullable_json_exact (self ):
87
87
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 ))
92
89
self .assertAggregateQuery (
93
90
ctx .captured_queries [0 ]["sql" ],
94
91
"lookup__nullablejsonmodel" ,
95
92
[{"$match" : {"$and" : [{"value" : {"$exists" : True }}, {"value" : None }]}}],
96
93
)
94
+ self .assertQuerySetEqual (
95
+ NullableJSONModel .objects .filter (value = None ),
96
+ self .null_objs [:- 1 ],
97
+ )
97
98
98
99
def test_none_filter_nullable_json_in (self ):
99
100
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 ]))
104
102
self .assertAggregateQuery (
105
103
ctx .captured_queries [0 ]["sql" ],
106
104
"lookup__nullablejsonmodel" ,
107
105
[{"$match" : {"$and" : [{"value" : {"$exists" : True }}, {"value" : {"$in" : [None ]}}]}}],
108
106
)
107
+ self .assertQuerySetEqual (
108
+ NullableJSONModel .objects .filter (value__in = [None ]),
109
+ self .null_objs [:- 1 ],
110
+ )
109
111
110
112
def test_none_filter_binary_operator_exact (self ):
111
113
with self .assertNumQueries (1 ) as ctx :
112
- self . assertQuerySetEqual (Book .objects .filter (title = None ), [] )
114
+ list (Book .objects .filter (title = None ))
113
115
self .assertAggregateQuery (
114
116
ctx .captured_queries [0 ]["sql" ],
115
117
"lookup__book" ,
@@ -124,10 +126,11 @@ def test_none_filter_binary_operator_exact(self):
124
126
}
125
127
],
126
128
)
129
+ self .assertQuerySetEqual (Book .objects .filter (title = None ), [])
127
130
128
131
def test_none_filter_binary_operator_in (self ):
129
132
with self .assertNumQueries (1 ) as ctx :
130
- self . assertQuerySetEqual (Book .objects .filter (title__in = [None ]), [] )
133
+ list (Book .objects .filter (title__in = [None ]))
131
134
self .assertAggregateQuery (
132
135
ctx .captured_queries [0 ]["sql" ],
133
136
"lookup__book" ,
@@ -142,3 +145,4 @@ def test_none_filter_binary_operator_in(self):
142
145
}
143
146
],
144
147
)
148
+ self .assertQuerySetEqual (Book .objects .filter (title__in = [None ]), [])
0 commit comments