Пример #1
0
    def test_next(self):
        soup = BeautifulSoup(open('tests/test.html').read())
        parser = RiddimguideBeautifulSoupParser(soup)

        self.assertFalse(parser.next())

        soup_nav = BeautifulSoup(open('tests/test_nav.html').read())
        parser_nav = RiddimguideBeautifulSoupParser(soup_nav)

        self.assertEquals("/tunes?q=one%20love&c=&page=2", parser_nav.next())
Пример #2
0
    def test_parse(self):
        soup = BeautifulSoup(open('tests/test.html').read())
        parser = RiddimguideBeautifulSoupParser(soup)
        tunes = parser.tunes()

        self.assertEquals(7, len(tunes))

        tune = {'artist': 'Bob Marley & Wailers',
                'song': 'Exodus',
                'riddim': 'Exodus',
                'year': '1977',
                'label': 'Tuff Gong',
                'producer': 'Robert Nesta \'Bob\' Marley & The Wailers'}

        self.assertEquals(tune, tunes[1])