def test_cached_file(self): path = os.path.dirname(os.path.abspath(__file__)) + "/test_file.csv" reader = RandomAccessReader(path, use_cache=True) reader = RandomAccessReader(path, use_cache=True) self.assertTrue(reader.number_of_lines == 34) lines = reader.get_lines(3, 3) self.assertTrue(len(lines) == 3) self.assertTrue('Learn Tons of Blogging Tips &Tricks' in lines[-1])
def test_text_file(self): path = os.path.dirname(os.path.abspath(__file__)) + "/test_file.csv" reader = RandomAccessReader(path) line = reader.get_lines(5) self.assertTrue('Learn Tons of Blogging Tips &Tricks' in line[0])
def test_multi_lines(self): path = os.path.dirname(os.path.abspath(__file__)) + "/test_file.csv" reader = RandomAccessReader(path) lines = reader.get_lines(3, 3) self.assertTrue(len(lines) == 3) self.assertTrue('Learn Tons of Blogging Tips &Tricks' in lines[-1])