Exemple #1
0
 def test_get_mentions(self):
     tweet = Tweet('This is a @test')
     self.assertEqual(tweet.get_mentions(), ['@test'])
Exemple #2
0
 def test_get_mentions_at_after_mention(self):
     tweet = Tweet('@01234567890123456789@')
     self.assertEqual(tweet.get_mentions(), [])
Exemple #3
0
 def test_get_topics(self):
     tweet = Tweet('This is #trendingin2016')
     self.assertEqual(tweet.get_topics(), ['#trendingin2016'])
Exemple #4
0
 def test_get_mentions_multiple(self):
     tweet = Tweet('Hi @randy and @kim')
     self.assertEqual(tweet.get_mentions(), ['@randy', '@kim'])
Exemple #5
0
 def test_get_mentions_empty_reply(self):
     tweet = Tweet('I am talking to no one @')
     self.assertEqual(tweet.get_mentions(), [])
Exemple #6
0
 def test_get_multi_links(self):
     tweet = Tweet(
         'Hey there @charles check these out, http://t.co/thisistest http://t.co/test22test'
     )
     self.assertEqual(tweet.get_links(),
                      ['http://t.co/thisistest', 'http://t.co/test22test'])
Exemple #7
0
 def test_get_mentions_nonalphaunderscore(self):
     tweet = Tweet("@replystopshere+right")
     self.assertEqual(tweet.get_mentions(), ["@replystopshere"])
Exemple #8
0
 def test_get_mentions_no_leading_at(self):
     tweet = Tweet("this@doesnothing")
     self.assertEqual(tweet.get_mentions(), [])
Exemple #9
0
 def test_get_topics(self):
     tweet = Tweet("This is #trendingin2016")
     self.assertEqual(tweet.get_topics(), ["#trendingin2016"])
Exemple #10
0
 def test_get_mentions_at_in_mention(self):
     tweet = Tweet("@does@not@work")
     self.assertEqual(tweet.get_mentions(), [])
Exemple #11
0
 def test_get_mentions_at_after_mention(self):
     tweet = Tweet("@01234567890123456789@")
     self.assertEqual(tweet.get_mentions(), [])
Exemple #12
0
 def test_get_mentions_empty_reply(self):
     tweet = Tweet("I am talking to no one @")
     self.assertEqual(tweet.get_mentions(), [])
Exemple #13
0
 def test_get_mentions_no_reply(self):
     tweet = Tweet("I am talking to myself")
     self.assertEqual(tweet.get_mentions(), [])
Exemple #14
0
 def test_get_mentions_multiple(self):
     tweet = Tweet("Hi @randy and @kim")
     self.assertEqual(tweet.get_mentions(), ["@randy", "@kim"])
Exemple #15
0
 def test_get_topics_contain_non_leading_hash(self):
     tweet = Tweet('#this#doesnothing')
     self.assertEqual(tweet.get_topics(), [])
Exemple #16
0
 def test_get_topics_multiple(self):
     tweet = Tweet("#one #two #three")
     self.assertEqual(tweet.get_topics(), ["#one", "#two", "#three"])
Exemple #17
0
 def test_get_topics_underscore(self):
     tweet = Tweet('#thiscuts_off')
     self.assertEqual(tweet.get_topics(), ['#thiscuts'])
Exemple #18
0
 def test_get_mentions(self):
     tweet = Tweet("This is a @test")
     self.assertEqual(tweet.get_mentions(), ["@test"])
Exemple #19
0
 def test_blank_tweet(self):
     tweet = Tweet('')
     self.assertEqual(tweet.get_links(), [])
     self.assertEqual(tweet.get_mentions(), [])
     self.assertEqual(tweet.get_topics(), [])
Exemple #20
0
 def test_get_topics_start_with_num(self):
     tweet = Tweet("#2016trending")
     self.assertEqual(tweet.get_topics(), [])
Exemple #21
0
 def test_get_mentions_nonalphaunderscore(self):
     tweet = Tweet('@replystopshere+right')
     self.assertEqual(tweet.get_mentions(), ['@replystopshere'])
Exemple #22
0
 def test_get_topics_contain_non_leading_hash(self):
     tweet = Tweet("#this#doesnothing")
     self.assertEqual(tweet.get_topics(), [])
Exemple #23
0
 def test_get_mentions_no_reply(self):
     tweet = Tweet('I am talking to myself')
     self.assertEqual(tweet.get_mentions(), [])
Exemple #24
0
 def test_get_topics_non_leading_hash(self):
     tweet = Tweet("thisdoesnot#workeither")
     self.assertEqual(tweet.get_topics(), [])
Exemple #25
0
 def test_get_mentions_at_in_mention(self):
     tweet = Tweet('@does@not@work')
     self.assertEqual(tweet.get_mentions(), [])
Exemple #26
0
 def test_get_topics_underscore(self):
     tweet = Tweet("#thiscuts_off")
     self.assertEqual(tweet.get_topics(), ["#thiscuts"])
Exemple #27
0
 def test_get_mentions_no_leading_at(self):
     tweet = Tweet('this@doesnothing')
     self.assertEqual(tweet.get_mentions(), [])
Exemple #28
0
 def test_get_links(self):
     tweet = Tweet("dont click random link http://t.co/thisistest")
     self.assertEqual(tweet.get_links(), ["http://t.co/thisistest"])
Exemple #29
0
 def test_get_topics_multiple(self):
     tweet = Tweet('#one #two #three')
     self.assertEqual(tweet.get_topics(), ['#one', '#two', '#three'])
Exemple #30
0
 def test_get_multi_links(self):
     tweet = Tweet("Hey there @charles check these out, http://t.co/thisistest http://t.co/test22test")
     self.assertEqual(tweet.get_links(), ["http://t.co/thisistest", "http://t.co/test22test"])
Exemple #31
0
 def test_get_topics_start_with_num(self):
     tweet = Tweet('#2016trending')
     self.assertEqual(tweet.get_topics(), [])
Exemple #32
0
 def test_too_long_url(self):
     tweet = Tweet("http://t.co/testingthisreallylongurl")
     self.assertEqual(tweet.get_links(), [])
Exemple #33
0
 def test_get_topics_non_leading_hash(self):
     tweet = Tweet('thisdoesnot#workeither')
     self.assertEqual(tweet.get_topics(), [])
Exemple #34
0
 def test_blank_tweet(self):
     tweet = Tweet("")
     self.assertEqual(tweet.get_links(), [])
     self.assertEqual(tweet.get_mentions(), [])
     self.assertEqual(tweet.get_topics(), [])
Exemple #35
0
 def test_get_links(self):
     tweet = Tweet('dont click random link http://t.co/thisistest')
     self.assertEqual(tweet.get_links(), ['http://t.co/thisistest'])
Exemple #36
0
 def test_get_mentions_max(self):
     tweet = Tweet("@01234567890123456789012345")
     self.assertEqual(tweet.get_mentions(), ["@01234567890123456789"])
Exemple #37
0
 def test_too_long_url(self):
     tweet = Tweet('http://t.co/testingthisreallylongurl')
     self.assertEqual(tweet.get_links(), [])
Exemple #38
0
 def test_get_mentions_underscore(self):
     tweet = Tweet('@Under_Score')
     self.assertEqual(tweet.get_mentions(), ['@Under_Score'])
Exemple #39
0
 def test_get_mentions_max(self):
     tweet = Tweet('@01234567890123456789012345')
     self.assertEqual(tweet.get_mentions(), ['@01234567890123456789'])
Exemple #40
0
 def test_get_mentions_underscore(self):
     tweet = Tweet("@Under_Score")
     self.assertEqual(tweet.get_mentions(), ["@Under_Score"])