def test_limit_iterator(self): """ Test setting the limit on the iterator. """ result_fetcher = functools.partial(self.protocol.get, '/athlete/activities') results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2) results.limit = 10 results = list(results) self.assertEquals(10, len(results))
def test_multiple_iterator_calls(self): """ Test multiple calls of the iterator. """ result_fetcher = functools.partial(self.protocol.get, '/athlete/activities') results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2) results.limit = 10 results1 = list(results) results2 = list(results) self.assertEquals(10, len(results1)) self.assertEquals(len(results1), len(results2))
def test_limit_iterator(self): """ Test setting the limit on the iterator. """ result_fetcher = functools.partial(self.protocol.get, '/athlete/activities') results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2) results.limit = 10 results = list(results) self.assertEqual(10, len(results))
def test_multiple_iterator_calls(self): """ Test multiple calls of the iterator. """ result_fetcher = functools.partial(self.protocol.get, '/athlete/activities') results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2) results.limit = 10 results1 = list(results) results2 = list(results) self.assertEqual(10, len(results1)) self.assertEqual(len(results1), len(results2))