Example #1
0
async def test_image_core():
    core = retaggr.ReverseSearch(config)
    result = await core.search_image(
        "paheal",
        "https://iris.paheal.net/_images/f0a277f7c4e80330b843f8002daf627e/1876780%20-%20Dancer_of_the_Boreal_Valley%20Dark_Souls%20Dark_Souls_3%20Sinensian.jpg"
    )
    assert 'dancer_of_the_boreal_valley' in result.tags
Example #2
0
async def test_reverse_search_callback():
    core = retaggr.ReverseSearch(config)
    calls = 0

    async def callback(engine, rresult):
        nonlocal calls
        calls += 1

    await core.reverse_search(
        "https://iris.paheal.net/_images/f0a277f7c4e80330b843f8002daf627e/1876780%20-%20Dancer_of_the_Boreal_Valley%20Dark_Souls%20Dark_Souls_3%20Sinensian.jpg",
        callback=callback)
    assert calls > 0
Example #3
0
async def test_core_search_image_not_all_api_keys():
    core = retaggr.ReverseSearch(retaggr.ReverseSearchConfig(
    ))  # Since we need a core without the config for this
    with pytest.raises(retaggr.MissingAPIKeysException):
        await core.search_image("danbooru", "irrelevant")
Example #4
0
async def test_core_search_no_download():
    core = retaggr.ReverseSearch(config)
    result = await core.reverse_search(
        "https://danbooru.donmai.us/data/__tsukumo_benben_touhou_drawn_by_elise_piclic__6e6da59922b923391f02ba1ce78f9b42.jpg"
    )
    assert 'tsukumo_benben' in result.tags
Example #5
0
async def test_core_search_image_not_a_booru():
    core = retaggr.ReverseSearch(config)
    with pytest.raises(retaggr.NotAValidEngineException):
        await core.search_image("nO", "irrelevant")
Example #6
0
def test_core_creation_with_no_iqdb():
    special_config = retaggr.ReverseSearchConfig(
        skip_iqdb=True, min_score=80.0)  # Minimal IQDB config
    core = retaggr.ReverseSearch(special_config)
    assert core.config == special_config
Example #7
0
def test_core_creation():
    core = retaggr.ReverseSearch(config)
    assert core.config == config