From 5c389c988c3770a5ac4280dbacfde2a9ded179d7 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Tue, 17 May 2016 14:49:52 -0700 Subject: [PATCH] Updating next_page() unit tests to check if skipped_results is set. --- gcloud/datastore/test_query.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcloud/datastore/test_query.py b/gcloud/datastore/test_query.py index 7a0e0672a94a4..f22f92e7e43f7 100644 --- a/gcloud/datastore/test_query.py +++ b/gcloud/datastore/test_query.py @@ -383,6 +383,7 @@ def test_ctor_defaults(self): self.assertTrue(iterator._query is query) self.assertEqual(iterator._limit, None) self.assertEqual(iterator._offset, None) + self.assertEqual(iterator._skipped_results, None) def test_ctor_explicit(self): client = self._makeClient() @@ -400,6 +401,7 @@ def test_next_page_no_cursors_no_more(self): self._addQueryResults(connection, cursor=b'') iterator = self._makeOne(query, client) entities, more_results, cursor = iterator.next_page() + self.assertEqual(iterator._skipped_results, None) self.assertEqual(cursor, None) self.assertFalse(more_results) @@ -423,13 +425,16 @@ def test_next_page_no_cursors_no_more_w_offset_and_limit(self): connection = _Connection() client = self._makeClient(connection) query = _Query(client, self._KIND, self._PROJECT, self._NAMESPACE) - self._addQueryResults(connection, cursor=b'') + skipped_results = object() + self._addQueryResults(connection, cursor=b'', + skipped_results=skipped_results) iterator = self._makeOne(query, client, 13, 29) entities, more_results, cursor = iterator.next_page() self.assertEqual(cursor, None) self.assertFalse(more_results) self.assertFalse(iterator._more_results) + self.assertEqual(iterator._skipped_results, skipped_results) self.assertEqual(len(entities), 1) self.assertEqual(entities[0].key.path, [{'kind': self._KIND, 'id': self._ID}]) @@ -461,6 +466,7 @@ def test_next_page_w_cursors_w_more(self): self.assertEqual(cursor, urlsafe_b64encode(self._END)) self.assertTrue(more_results) self.assertTrue(iterator._more_results) + self.assertEqual(iterator._skipped_results, None) self.assertEqual(iterator._end_cursor, None) self.assertEqual(urlsafe_b64decode(iterator._start_cursor), self._END) self.assertEqual(len(entities), 1)