def test_run(downloader): pager = mal.RecommendationPager(downloader) parser = mal.RecommendationParser() for page in range(5): page_content = pager.get(page) assert len(parser.parse(page_content)) == 100
def test_manga_pager(downloader): pager = mal.RecommendationPager(downloader, mal.RecommendationType.MANGA) page0 = pager.get(0) assert '<title>Manga Recommendations - MyAnimeList.net\n</title>' in page0 assert '[1]' in page0 page1 = pager.get(1) assert '<title>Manga Recommendations - MyAnimeList.net\n</title>' in page1 assert '[2]' in page1
def test_pager(downloader): pager = mal.RecommendationPager(downloader) page0 = pager.get(0) assert '<title>Anime Recommendations - MyAnimeList.net\n</title>' in page0 assert '[1]' in page0 page1 = pager.get(1) assert '<title>Anime Recommendations - MyAnimeList.net\n</title>' in page1 assert '[2]' in page1
def test_pager_iter(downloader): pager = mal.RecommendationPager(downloader) pager_iter = iter(pager) page0 = next(pager_iter) assert '<title>Anime Recommendations - MyAnimeList.net\n</title>' in page0 assert '[1]' in page0 page1 = next(pager_iter) assert '<title>Anime Recommendations - MyAnimeList.net\n</title>' in page1 assert '[2]' in page1
def test_pager_not_found(downloader): pager = mal.RecommendationPager(downloader) with pytest.raises(mal.PageNotFoundError): pager.get(1e9)