def test_many_edges(self):
     tweet = Tweet('Hello #One #two #THREE', 'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = ['#one-#two', '#one-#three', '#three-#two']
     edges = tweet.get_edges()
     self.assertEqual(len(expected_edges), len(edges))
     for edge in edges:
         self.assertIn(str(edge), expected_edges)
 def test_many_edges(self):
     tweet = Tweet('Hello #One #two #THREE',
                   'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = ['#one-#two', '#one-#three', '#three-#two']
     edges = tweet.get_edges()
     self.assertEqual(len(expected_edges), len(edges))
     for edge in edges:
         self.assertIn(str(edge), expected_edges)
Ejemplo n.º 3
0
 def test_remove_multiple_tweets_from_window(self):
     tweets = [
         Tweet(t['text'], t['created_at']) for t in tweets_series[0:5]
     ]
     tweets += [
         Tweet('New version #Hadoop #Apache',
               'Thu Oct 29 17:52:57 +0000 2015')
     ]
     graph = self.get_graph_from_tweets(tweets)
     self.assert_graph_degree(graph, 6.0, 5.0)
 def test_edges_for_no_hashtags(self):
     tweet = Tweet('Hello No hash', 'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = []
     self.assertEqual(expected_edges, tweet.get_edges())
 def test_one_edge(self):
     tweet = Tweet('Hello #Abra #Kadabra', 'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = ['#abra-#kadabra']
     edges = tweet.get_edges()
     self.assertEqual(len(expected_edges), len(edges))
     self.assertEqual(expected_edges[0], str(edges[0]))
 def test_edges_for_no_hashtags(self):
     tweet = Tweet('Hello No hash', 'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = []
     self.assertEqual(expected_edges, tweet.get_edges())
 def test_one_edge(self):
     tweet = Tweet('Hello #Abra #Kadabra', 'Thu Oct 30 18:10:49 +0000 2015')
     expected_edges = ['#abra-#kadabra']
     edges = tweet.get_edges()
     self.assertEqual(len(expected_edges), len(edges))
     self.assertEqual(expected_edges[0], str(edges[0]))
 def test_name(self):
     tweet = Tweet('Hello', 'Thu Oct 30 18:10:49 +0000 2015')
     expected = 'Hello (timestamp: Thu Oct 30 18:10:49 +0000 2015)'
     self.assertEqual(expected, str(tweet))
Ejemplo n.º 9
0
 def test_tweets_in_60_window(self):
     tweets = [
         Tweet(t['text'], t['created_at']) for t in tweets_series[0:6]
     ]
     graph = self.get_graph_from_tweets(tweets)
     self.assert_graph_degree(graph, 10.0, 6.0)
Ejemplo n.º 10
0
 def test_two_more_tweets(self):
     tweets = [
         Tweet(t['text'], t['created_at']) for t in tweets_series[0:5]
     ]
     graph = self.get_graph_from_tweets(tweets)
     self.assert_graph_degree(graph, 12.0, 6.0)
Ejemplo n.º 11
0
 def test_tweet_with_no_edges(self):
     tweets = [
         Tweet(t['text'], t['created_at']) for t in tweets_series[0:3]
     ]
     graph = self.get_graph_from_tweets(tweets)
     self.assert_graph_degree(graph, 8.0, 4.0)
Ejemplo n.º 12
0
 def test_degree_with_only_one_edge(self):
     tweets = [
         Tweet(t['text'], t['created_at']) for t in tweets_series[0:1]
     ]
     graph = self.get_graph_from_tweets(tweets)
     self.assert_graph_degree(graph, 2.0, 2.0)