本文整理匯總了Python中Twitter_Utils.EternalProcess.EternalProcess.remove_first_line_from_file方法的典型用法代碼示例。如果您正苦於以下問題:Python EternalProcess.remove_first_line_from_file方法的具體用法?Python EternalProcess.remove_first_line_from_file怎麽用?Python EternalProcess.remove_first_line_from_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter_Utils.EternalProcess.EternalProcess
的用法示例。
在下文中一共展示了EternalProcess.remove_first_line_from_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_remove_first_line_from_file
# 需要導入模塊: from Twitter_Utils.EternalProcess import EternalProcess [as 別名]
# 或者: from Twitter_Utils.EternalProcess.EternalProcess import remove_first_line_from_file [as 別名]
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:
for _ in reader:
count_1 += 1
reader.close()
self.assertIs(True, eternal_process.remove_first_line_from_file(path))
count_2 = 0
with open(path, 'r') as reader:
for _ in reader:
count_2 += 1
reader.close()
self.assertEqual(count_1-1, count_2)
示例2: test_remove_first_line_from_file_raises_ioerror
# 需要導入模塊: from Twitter_Utils.EternalProcess import EternalProcess [as 別名]
# 或者: from Twitter_Utils.EternalProcess.EternalProcess import remove_first_line_from_file [as 別名]
def test_remove_first_line_from_file_raises_ioerror(self):
eternal_process = EternalProcess()
path = os.getcwd() + '/Twitter_Utils/data/tweets/not_a_real_path/not_a_real_path.txt'
self.assertIs(False, eternal_process.remove_first_line_from_file(path))