@@ -148,8 +148,9 @@ class SomeKind(ndb.Model):
148148 bar = ndb .StringProperty ()
149149
150150 query = SomeKind .query (distinct_on = ("foo" ,))
151- results = eventually (query .fetch , _length_equals (2 ))
151+ eventually (SomeKind . query () .fetch , _length_equals (6 ))
152152
153+ results = query .fetch ()
153154 results = sorted (results , key = operator .attrgetter ("foo" ))
154155
155156 assert results [0 ].foo == 0
@@ -173,6 +174,8 @@ class SomeKind(ndb.Model):
173174 entity2 .put ()
174175 dispose_of (entity2 .key ._key )
175176
177+ eventually (SomeKind .query ().fetch , _length_equals (1 ))
178+
176179 query = SomeKind .query (namespace = OTHER_NAMESPACE )
177180 results = eventually (query .fetch , _length_equals (1 ))
178181
@@ -190,8 +193,10 @@ def test_filter_equal(ds_entity):
190193 class SomeKind (ndb .Model ):
191194 foo = ndb .IntegerProperty ()
192195
196+ eventually (SomeKind .query ().fetch , _length_equals (5 ))
197+
193198 query = SomeKind .query (SomeKind .foo == 2 )
194- results = eventually ( query .fetch , _length_equals ( 1 ) )
199+ results = query .fetch ( )
195200 assert results [0 ].foo == 2
196201
197202
@@ -204,9 +209,10 @@ def test_filter_not_equal(ds_entity):
204209 class SomeKind (ndb .Model ):
205210 foo = ndb .IntegerProperty ()
206211
207- query = SomeKind .query (SomeKind .foo != 2 )
208- results = eventually (query .fetch , _length_equals (4 ))
212+ eventually (SomeKind .query ().fetch , _length_equals (5 ))
209213
214+ query = SomeKind .query (SomeKind .foo != 2 )
215+ results = query .fetch ()
210216 results = sorted (results , key = operator .attrgetter ("foo" ))
211217 assert [entity .foo for entity in results ] == [0 , 1 , 3 , 4 ]
212218
@@ -228,9 +234,10 @@ def make_entities():
228234 dispose_of (key ._key )
229235
230236 make_entities ().check_success ()
231- query = SomeKind .query (ndb .OR (SomeKind .foo == 1 , SomeKind .bar == "c" ))
232- results = eventually (query .fetch , _length_equals (2 ))
237+ eventually (SomeKind .query ().fetch , _length_equals (3 ))
233238
239+ query = SomeKind .query (ndb .OR (SomeKind .foo == 1 , SomeKind .bar == "c" ))
240+ results = query .fetch ()
234241 results = sorted (results , key = operator .attrgetter ("bar" ))
235242 assert [entity .bar for entity in results ] == ["a" , "c" ]
236243
@@ -329,10 +336,10 @@ def test_offset_and_limit(ds_entity):
329336 class SomeKind (ndb .Model ):
330337 foo = ndb .IntegerProperty ()
331338
339+ eventually (SomeKind .query ().fetch , _length_equals (5 ))
340+
332341 query = SomeKind .query (order_by = ["foo" ])
333- results = eventually (
334- lambda : query .fetch (offset = 2 , limit = 2 ), _length_equals (2 )
335- )
342+ results = query .fetch (offset = 2 , limit = 2 )
336343 assert [entity .foo for entity in results ] == [2 , 3 ]
337344
338345
@@ -357,11 +364,11 @@ def make_entities():
357364 dispose_of (key ._key )
358365
359366 make_entities ().check_success ()
367+ eventually (SomeKind .query ().fetch , _length_equals (6 ))
368+
360369 query = SomeKind .query (ndb .OR (SomeKind .bar == "a" , SomeKind .bar == "b" ))
361370 query = query .order (SomeKind .foo )
362- results = eventually (
363- lambda : query .fetch (offset = 1 , limit = 2 ), _length_equals (2 )
364- )
371+ results = query .fetch (offset = 1 , limit = 2 )
365372
366373 assert [entity .foo for entity in results ] == [1 , 2 ]
367374
0 commit comments