def parseTwitterStatus(self): """A real-world Twitter status feed can be parsed.""" name = self.example_account owner = self.example_account url = "http://twitter.com/" + self.example_account t = TwitterStatus(name, owner, url) t.parse()
def testIgnoreRetweet(self): """Twitter retweets, which are annoying, can be ignored.""" self.assertTrue(TwitterStatus.is_retweet(self.tweet_with_retweet))
def testIgnoreReply(self): """Twitter replies can be ignored.""" self.assertTrue(TwitterStatus.is_reply(self.tweet_with_reply))
def testLinkUsernameWithPunctuation(self): """A Twitter username with trailing punctuation can be linked.""" expected = """@<a href="http://twitter.com/NuerOb/">NuerOb</a>: I am like a pot roast, but better!""" result = TwitterStatus.link_users(self.tweet_with_username) assert result == expected
def testLinkUsername(self): """Twitter usernames are automatically linked.""" expected = """@<a href="http://twitter.com/mozzarella/">mozzarella</a> Are you buffalo or garden variety?""" result = TwitterStatus.link_users(self.tweet_with_username) assert result == expected
def testLinkHashtag(self): """Twitter hashtags are automatically linked.""" expected = """This caprese has changed my life! <a href="http://twitter.com/search?q=%23inspirationalsalads">#inspirationalsalads</a>""" result = TwitterStatus.link_hashtags(self.tweet_with_hashtag) assert result == expected