def test_remove_last_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_last_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)
def test_remove_last_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_last_line_from_file(path))