def test_many_queries_not_in_one_article(query): index = InvertedIndex() article_id = '12' with open(ONE_ARTICLE_PATH, 'r') as fd: index.build(fd) assert article_id not in index.find_articles( query), 'find article in query that not in one article'
def test_one_article(): index = InvertedIndex() with open(ONE_ARTICLE_PATH, 'r') as fd: index.build(fd) with open(ONE_ARTICLE_PATH, 'r') as fd: article_id, words = fd.readline().split(maxsplit=1) words = words.split() assert article_id == index.find_articles( words), 'didnt find article in query of all words in article'