Example #1
0
 def _populate(self):
     urls = [
         "http://rss.nytimes.com/services/xml/rss/nyt/Hockey.xml",
         "http://rss.nytimes.com/services/xml/rss/nyt/Baseball.xml",
         "http://rss.nytimes.com/services/xml/rss/nyt/Golf.xml",
         "http://tsn.ca/nhl",
         "http://tsn.ca/nba",
         "http://tsn.ca/nfl",
         "http://tsn.ca/cfl",
         "http://tsn.ca/mlb",
     ]
     for url in urls:
         f = Feed()
         f.feed_url = url
         f.save()
Example #2
0
    def dumb_test_tag_baseball(self):

        """
        In theory, every article from this feed should get tagged as baseball.
        This isn't really a unit test though, and would be better in some kind
        of performance testing suite; I'm not sure that pulling from an
        unknown outside source is a recipe for successful unit tests.

        Maybe add this back to the suite when our tagging mechanism is smarter
        """

        st = SportTagger()
        feed = Feed(feed_url = "http://rss.nytimes.com/services/xml/rss/nyt/Baseball.xml")
        feed.save()
        feed.get_latest_articles()
        for article in feed.article_set.all():
            scores = st.get_tag_scores(article)
            print("[{}] \t {}".format(scores["likeliest_tag"],article.article_title))
            self.assertTrue(scores["likeliest_tag"] == "Baseball")