Exemple #1
0
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
Exemple #2
0
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'
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
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
Exemple #7
0
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