1717import unittest
1818
1919import httplib2
20+ import six
2021
2122from google .cloud ._helpers import UTC
2223from google .cloud import datastore
@@ -260,14 +261,16 @@ def test_limit_queries(self):
260261
261262 # Fetch characters.
262263 iterator = query .fetch (limit = limit )
263- character_entities , _ , cursor = iterator .next_page ()
264+ page = six .next (iterator .pages )
265+ character_entities = list (page )
266+ cursor = iterator .next_page_token
264267 self .assertEqual (len (character_entities ), limit )
265268
266269 # Check cursor after fetch.
267270 self .assertIsNotNone (cursor )
268271
269- # Fetch remaining of characters.
270- new_character_entities = list (iterator )
272+ # Fetch remaining characters.
273+ new_character_entities = list (query . fetch ( start_cursor = cursor ) )
271274 characters_remaining = len (self .CHARACTERS ) - limit
272275 self .assertEqual (len (new_character_entities ), characters_remaining )
273276
@@ -362,7 +365,9 @@ def test_query_paginate_with_offset(self):
362365 iterator = page_query .fetch (limit = limit , offset = offset )
363366
364367 # Fetch characters.
365- entities , _ , cursor = iterator .next_page ()
368+ page = six .next (iterator .pages )
369+ entities = list (page )
370+ cursor = iterator .next_page_token
366371 self .assertEqual (len (entities ), limit )
367372 self .assertEqual (entities [0 ]['name' ], 'Robb' )
368373 self .assertEqual (entities [1 ]['name' ], 'Bran' )
@@ -385,7 +390,9 @@ def test_query_paginate_with_start_cursor(self):
385390 iterator = page_query .fetch (limit = limit , offset = offset )
386391
387392 # Fetch characters.
388- entities , _ , cursor = iterator .next_page ()
393+ page = six .next (iterator .pages )
394+ entities = list (page )
395+ cursor = iterator .next_page_token
389396 self .assertEqual (len (entities ), limit )
390397
391398 # Use cursor to create a fresh query.
0 commit comments