Пример #1
0
 def test_get_mentions(self):
     tweet = Tweet('This is a @test')
     self.assertEqual(tweet.get_mentions(), ['@test'])
Пример #2
0
 def test_get_mentions_at_after_mention(self):
     tweet = Tweet('@01234567890123456789@')
     self.assertEqual(tweet.get_mentions(), [])
Пример #3
0
 def test_get_topics(self):
     tweet = Tweet('This is #trendingin2016')
     self.assertEqual(tweet.get_topics(), ['#trendingin2016'])
Пример #4
0
 def test_get_mentions_multiple(self):
     tweet = Tweet('Hi @randy and @kim')
     self.assertEqual(tweet.get_mentions(), ['@randy', '@kim'])
Пример #5
0
 def test_get_mentions_empty_reply(self):
     tweet = Tweet('I am talking to no one @')
     self.assertEqual(tweet.get_mentions(), [])
Пример #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'])
Пример #7
0
 def test_get_mentions_nonalphaunderscore(self):
     tweet = Tweet("@replystopshere+right")
     self.assertEqual(tweet.get_mentions(), ["@replystopshere"])
Пример #8
0
 def test_get_mentions_no_leading_at(self):
     tweet = Tweet("this@doesnothing")
     self.assertEqual(tweet.get_mentions(), [])
Пример #9
0
 def test_get_topics(self):
     tweet = Tweet("This is #trendingin2016")
     self.assertEqual(tweet.get_topics(), ["#trendingin2016"])
Пример #10
0
 def test_get_mentions_at_in_mention(self):
     tweet = Tweet("@does@not@work")
     self.assertEqual(tweet.get_mentions(), [])
Пример #11
0
 def test_get_mentions_at_after_mention(self):
     tweet = Tweet("@01234567890123456789@")
     self.assertEqual(tweet.get_mentions(), [])
Пример #12
0
 def test_get_mentions_empty_reply(self):
     tweet = Tweet("I am talking to no one @")
     self.assertEqual(tweet.get_mentions(), [])
Пример #13
0
 def test_get_mentions_no_reply(self):
     tweet = Tweet("I am talking to myself")
     self.assertEqual(tweet.get_mentions(), [])
Пример #14
0
 def test_get_mentions_multiple(self):
     tweet = Tweet("Hi @randy and @kim")
     self.assertEqual(tweet.get_mentions(), ["@randy", "@kim"])
Пример #15
0
 def test_get_topics_contain_non_leading_hash(self):
     tweet = Tweet('#this#doesnothing')
     self.assertEqual(tweet.get_topics(), [])
Пример #16
0
 def test_get_topics_multiple(self):
     tweet = Tweet("#one #two #three")
     self.assertEqual(tweet.get_topics(), ["#one", "#two", "#three"])
Пример #17
0
 def test_get_topics_underscore(self):
     tweet = Tweet('#thiscuts_off')
     self.assertEqual(tweet.get_topics(), ['#thiscuts'])
Пример #18
0
 def test_get_mentions(self):
     tweet = Tweet("This is a @test")
     self.assertEqual(tweet.get_mentions(), ["@test"])
Пример #19
0
 def test_blank_tweet(self):
     tweet = Tweet('')
     self.assertEqual(tweet.get_links(), [])
     self.assertEqual(tweet.get_mentions(), [])
     self.assertEqual(tweet.get_topics(), [])
Пример #20
0
 def test_get_topics_start_with_num(self):
     tweet = Tweet("#2016trending")
     self.assertEqual(tweet.get_topics(), [])
Пример #21
0
 def test_get_mentions_nonalphaunderscore(self):
     tweet = Tweet('@replystopshere+right')
     self.assertEqual(tweet.get_mentions(), ['@replystopshere'])
Пример #22
0
 def test_get_topics_contain_non_leading_hash(self):
     tweet = Tweet("#this#doesnothing")
     self.assertEqual(tweet.get_topics(), [])
Пример #23
0
 def test_get_mentions_no_reply(self):
     tweet = Tweet('I am talking to myself')
     self.assertEqual(tweet.get_mentions(), [])
Пример #24
0
 def test_get_topics_non_leading_hash(self):
     tweet = Tweet("thisdoesnot#workeither")
     self.assertEqual(tweet.get_topics(), [])
Пример #25
0
 def test_get_mentions_at_in_mention(self):
     tweet = Tweet('@does@not@work')
     self.assertEqual(tweet.get_mentions(), [])
Пример #26
0
 def test_get_topics_underscore(self):
     tweet = Tweet("#thiscuts_off")
     self.assertEqual(tweet.get_topics(), ["#thiscuts"])
Пример #27
0
 def test_get_mentions_no_leading_at(self):
     tweet = Tweet('this@doesnothing')
     self.assertEqual(tweet.get_mentions(), [])
Пример #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"])
Пример #29
0
 def test_get_topics_multiple(self):
     tweet = Tweet('#one #two #three')
     self.assertEqual(tweet.get_topics(), ['#one', '#two', '#three'])
Пример #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"])
Пример #31
0
 def test_get_topics_start_with_num(self):
     tweet = Tweet('#2016trending')
     self.assertEqual(tweet.get_topics(), [])
Пример #32
0
 def test_too_long_url(self):
     tweet = Tweet("http://t.co/testingthisreallylongurl")
     self.assertEqual(tweet.get_links(), [])
Пример #33
0
 def test_get_topics_non_leading_hash(self):
     tweet = Tweet('thisdoesnot#workeither')
     self.assertEqual(tweet.get_topics(), [])
Пример #34
0
 def test_blank_tweet(self):
     tweet = Tweet("")
     self.assertEqual(tweet.get_links(), [])
     self.assertEqual(tweet.get_mentions(), [])
     self.assertEqual(tweet.get_topics(), [])
Пример #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'])
Пример #36
0
 def test_get_mentions_max(self):
     tweet = Tweet("@01234567890123456789012345")
     self.assertEqual(tweet.get_mentions(), ["@01234567890123456789"])
Пример #37
0
 def test_too_long_url(self):
     tweet = Tweet('http://t.co/testingthisreallylongurl')
     self.assertEqual(tweet.get_links(), [])
Пример #38
0
 def test_get_mentions_underscore(self):
     tweet = Tweet('@Under_Score')
     self.assertEqual(tweet.get_mentions(), ['@Under_Score'])
Пример #39
0
 def test_get_mentions_max(self):
     tweet = Tweet('@01234567890123456789012345')
     self.assertEqual(tweet.get_mentions(), ['@01234567890123456789'])
Пример #40
0
 def test_get_mentions_underscore(self):
     tweet = Tweet("@Under_Score")
     self.assertEqual(tweet.get_mentions(), ["@Under_Score"])