Esempio n. 1
0
    def test_recursive_links_not_separated_equivalent_separated(self):
        """
        Test that not separating the links returns the same articles as when separating them.
        """

        page = 'Stichting Voortgezet Onderwijs van de Bovenwindse Eilanden'
        separate_articles = links.collect_recursive(page, 2, separate=True)
        articles = links.collect_recursive(page, 2, separate=False)

        self.assertEqual(
            set(articles),
            set([
                article for articles in separate_articles.values()
                for article in articles
            ]))
Esempio n. 2
0
    def test_recursive_links_not_separated_multiple_pages(self):
        """
        Test that getting recursive links from multiple pages without separating them works.
        """

        page = 'Stichting Voortgezet Onderwijs van de Bovenwindse Eilanden'
        articles = links.collect_recursive(page, 2, separate=False)
        self.assertTrue(len(articles))
Esempio n. 3
0
    def test_recursive_links_multiple_levels(self):
        """
        Test that recursive collection with multiple levels returns more pages.
        """

        page = 'Stichting Voortgezet Onderwijs van de Bovenwindse Eilanden'
        articles = links.collect_recursive(page, 2, separate=True)
        self.assertTrue(page in articles)
        self.assertGreater(len(articles), 1)
Esempio n. 4
0
    def test_recursive_links_separated_multiple_pages(self):
        """
        Test that getting recursive links from separate pages and separating them by article works.
        """

        pages = ['Olympique Lyonnais', 'Michelangelo']
        articles = links.collect_recursive(pages, 1, separate=True)
        self.assertEqual(set(pages), set(articles.keys()))
        self.assertTrue(all(len(links) for links in articles.values()))
Esempio n. 5
0
    def test_recursive_links_not_separated(self):
        """
        Test that getting recursive links without separating them works.
        """

        page = 'Olympique Lyonnais'
        articles = links.collect_recursive(page, 1, separate=False)
        self.assertEqual(set(articles), set(links.collect(page,
                                                          separate=False)))
Esempio n. 6
0
    def test_recursive_links_level_one(self):
        """
        Test that recursive collection with a level of 1 returns the same results as normal link collection.
        """

        page = 'Olympique Lyonnais'
        articles = links.collect_recursive(page, 1, separate=False)
        self.assertEqual(set(articles), set(links.collect(page,
                                                          separate=False)))
Esempio n. 7
0
    def test_recursive_links_introduction_subset(self):
        """
        Test that when getting recursive links from the introduction retrieves a subset of normal recursive link retrieval.
        """

        page = 'Scholengemeenschap Bonaire'
        intro_articles = links.collect_recursive(page,
                                                 2,
                                                 separate=True,
                                                 introduction_only=True)
        articles = links.collect_recursive(page,
                                           2,
                                           separate=True,
                                           introduction_only=False)
        self.assertLess(len(intro_articles), len(articles))
        self.assertTrue(
            all(
                len(intro_articles[article]) < len(articles[article])
                for article in intro_articles))
Esempio n. 8
0
    def test_recursive_links_separated(self):
        """
        Test that getting recursive links and separating them by article works.
        """

        page = 'Olympique Lyonnais'
        articles = links.collect_recursive(page, 1, separate=True)
        self.assertTrue(page in articles)
        self.assertEqual(set(articles.get(page)),
                         set(links.collect(page, separate=True).get(page)))