예제 #1
0
    def test_search_alternate_links(self):
        feed_str = get_data_file("bbc_homepage.html")
        feed = feedparser.parse(feed_str)
        links = feedutil.search_alternate_links(feed)
        self.assertListEqual(links, [
            "http://newsrss.bbc.co.uk/rss/newsonline_world_edition/"
            "front_page/rss.xml"])

        feed_str = get_data_file("newsweek_homepage.html")
        feed = feedparser.parse(feed_str)
        links = feedutil.search_alternate_links(feed)
        self.assertListEqual(links, [
            "http://feeds.newsweek.com/newsweek/TopNews"])
예제 #2
0
 def test_search_alternate_links_double_function(self):
     feed_str = get_data_file("smp.no.html")
     feed = feedparser.parse(feed_str)
     links = feedutil.search_alternate_links(feed)
     self.assertListEqual(links,
         [u'http://www.smp.no/?service=rss',
         u'http://www.smp.no/?service=rss&t=0',
         u'http://www.smp.no/nyheter/?service=rss',
         u'http://www.smp.no/kultur/?service=rss']
     )
     links = feedutil.search_links_url("http://www.smp.no/", feed_str)
     self.assertListEqual(links,
         [u'http://www.smp.no/?service=rss',
         u'http://www.smp.no/?service=rss&t=0',
         u'http://www.smp.no/nyheter/?service=rss',
         u'http://www.smp.no/kultur/?service=rss']
     )