def test_get_index_data(self): data_source = DataSource(self.books_file) inverted_index = InvertedIndex(self.index_file) inverted_index.get_inverted_index(data_source.read_file()) with open(inverted_index.file_name, 'r') as f: keywords_dict = pickle.load(f) self.assertEqual(keywords_dict[self.keyword], ['B000UZNREG'])
def test_read_file(self): data_source = DataSource(self.books_file) for id, title in data_source.read_file(): self.assertEqual(id, self.book_id) self.assertEqual(title, self.book_title) break