def test_solo_query(): names = command.parse_queries('[Gilder Bairn]') assert len(names) == 1 assert names[0] == 'gilder bairn' results = command.results_from_queries(names, whoosh_search.WhooshSearcher())[0] assert len(results) == 1
def test_cards_from_queries2(): bot = Container() bot.searcher = whoosh_search.WhooshSearcher() result = command.cards_from_queries2(['bolt'], bot)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Lightning Bolt'
def test_results_from_queries(): searcher = whoosh_search.WhooshSearcher() result = command.results_from_queries(['bolt'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Lightning Bolt' result = command.results_from_queries(['Far/Away'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Far // Away' result = command.results_from_queries(['Jötun Grunt'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Jötun Grunt' result = command.results_from_queries(['Jotun Grunt'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Jötun Grunt' result = command.results_from_queries(['Ready / Willing'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Ready // Willing' result = command.results_from_queries(['Fire // Ice'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Fire // Ice' result = command.results_from_queries(['Upheaval'], searcher)[0] assert result.has_match() assert not result.is_ambiguous() assert result.get_best_match() == 'Upheaval'
def test_split_cards(): cards = oracle.load_cards(['Armed // Dangerous']) assert len(cards) == 1 assert image_fetcher.download_image(cards) is not None names = command.parse_queries('[Toil // Trouble]') assert len(names) == 1 results = command.results_from_queries(names, whoosh_search.WhooshSearcher())[0] assert len(results) == 1
def test_partial_query(): names = command.parse_queries("[Kamahl's]") assert len(names) == 1 results = command.results_from_queries(names, whoosh_search.WhooshSearcher())[0] assert len(results.get_ambiguous_matches()) == 3
def test_legend_query(): names = command.parse_queries('[Kamahl]') assert len(names) == 1 results = command.results_from_queries(names, whoosh_search.WhooshSearcher())[0] assert len(results.get_ambiguous_matches()) == 2
def test_double_query(): names = command.parse_queries('[Mother of Runes] [Ghostfire]') assert len(names) == 2 results = command.results_from_queries(names, whoosh_search.WhooshSearcher()) assert len(results) == 2