Esempio n. 1
0
    def test_download_iterator(self):
        search = Search(max_results=221, max_results_per_call=33, time_sleep=0)

        with patch.object(feedparser, "parse", new_callable=get_parse_callable):
            results = search.download(iterative=True)

        self.assertTrue(callable(results))
Esempio n. 2
0
    def test_download(self):
        search = Search(max_results=221, max_chunk_results=33, time_sleep=0)

        with patch.object(feedparser, "parse",
                          new_callable=get_parse_callable):
            results = search.download(iterative=False)
        self.assertEqual(len(results), 221)
Esempio n. 3
0
    def test_get_next(self):

        search = Search(max_results=200, max_results_per_call=30, time_sleep=0)

        with patch.object(feedparser, "parse", new_callable=get_parse_callable):

            lenghts = [len(result) for result in search._get_next()]

        self.assertListEqual(lenghts, [30, 30, 30, 30, 30, 30, 20])