本文整理汇总了Python中Twitter_Utils.EternalProcess.EternalProcess.get_game_name_base_file_path方法的典型用法代码示例。如果您正苦于以下问题:Python EternalProcess.get_game_name_base_file_path方法的具体用法?Python EternalProcess.get_game_name_base_file_path怎么用?Python EternalProcess.get_game_name_base_file_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twitter_Utils.EternalProcess.EternalProcess
的用法示例。
在下文中一共展示了EternalProcess.get_game_name_base_file_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_team_name_base_file_path
# 需要导入模块: from Twitter_Utils.EternalProcess import EternalProcess [as 别名]
# 或者: from Twitter_Utils.EternalProcess.EternalProcess import get_game_name_base_file_path [as 别名]
def test_get_team_name_base_file_path(self):
eternal_process = EternalProcess()
# ExpectedNone
self.assertIsNone(eternal_process.get_team_name_base_file_path(0))
eternal_process.game_name_list.append('Cavaliers-vs-Bronx')
expected = os.getcwd() + '/Twitter_Utils/data/tweets/Cavaliers-vs-Bronx/Cavaliers-vs-Bronx.txt'
self.assertEqual(expected, eternal_process.get_game_name_base_file_path(0))
示例2: TestEternalProcess
# 需要导入模块: from Twitter_Utils.EternalProcess import EternalProcess [as 别名]
# 或者: from Twitter_Utils.EternalProcess.EternalProcess import get_game_name_base_file_path [as 别名]
#.........这里部分代码省略.........
now_plus_10 = now_plus_10.strftime('%H:%M')
self.assertEqual(now_plus_10, eternal_process.get_time_to_end_stream(10))
def test_get_write_path_for_days_games(self):
eternal_process = EternalProcess()
wd = os.getcwd()
pos = wd.find("BigDataMonsters")
if pos > 0: # pragma: no cover
path = wd[0:pos+15]
else:
path = wd
base = path + '/Twitter_Utils/data/daily-logs/'
end = datetime.datetime.now().strftime('%Y-%m-%d') + '.json'
self.assertEqual(base + end, eternal_process.get_write_path_for_days_games())
def test_is_time_to_get_game_data_for_day(self):
eternal_process = EternalProcess()
eternal_process.time_to_check_games_for_the_day = datetime.datetime.now().strftime('%H:%M')
self.assertEqual(True, eternal_process.is_time_to_get_game_data_for_day())
eternal_process.time_to_check_games_for_the_day = '04:14'
self.assertEqual(False, eternal_process.is_time_to_get_game_data_for_day())
def test_sleep_for(self):
eternal_process = EternalProcess()
time_now = datetime.datetime.now()
eternal_process.sleep_for(1, time.time())
time_now_plus_1 = datetime.datetime.now().strftime('%H:%M:%S')
time_now += datetime.timedelta(seconds=1)
time_now = time_now.strftime('%H:%M:%S')
self.assertEqual(time_now, time_now_plus_1)
def test_map_reduce_tweets_after_disconnect(self):
self.eternalProcess.game_name_list.append('123')
path = self.eternalProcess.get_game_name_base_file_path(0)
self.assertIsNotNone(self.eternalProcess.map_reduce_tweets_after_disconnect(path, 0))
def test_get_game_name_base_file_path(self):
self.eternalProcess.game_name_list.append('2016-03-05-Pacers-vs-Wizards')
self.assertEqual(os.getcwd() + '/Twitter_Utils/data/tweets/2016-03-05-Pacers-vs-Wizards/'
'2016-03-05-Pacers-vs-Wizards.txt',
self.eternalProcess.get_game_name_base_file_path(0))
def test_delete_stream_end_time_game_name_from_lists(self):
eternal_process = EternalProcess()
eternal_process.stream_list.append('Stream Test')
eternal_process.end_times_list.append('End Time Test')
eternal_process.game_name_list.append('Game Test')
self.assertIs(len(eternal_process.stream_list), 1)
self.assertIs(len(eternal_process.end_times_list), 1)
self.assertIs(len(eternal_process.game_name_list), 1)
eternal_process.delete_stream_end_time_game_name_from_lists(0)
self.assertIs(len(eternal_process.stream_list), 0)
self.assertIs(len(eternal_process.end_times_list), 0)
self.assertIs(len(eternal_process.game_name_list), 0)
def test_get_game_name_directory(self):
eternal_process = EternalProcess()
eternal_process.game_name_list.append('Test_game')
expected = 'Twitter_Utils/data/tweets/Test_game/'
self.assertEqual(expected, eternal_process.get_game_name_directory(0))
def test_remove_first_line_from_file(self):
eternal_process = EternalProcess()
path = os.getcwd() + '/Twitter_Utils/data/tweets/base_tweets_for_tests/base_tweets_for_tests.txt'
count_1 = 0
with open(path, 'r') as reader: