예제 #1
0
async def test_item_id_search() -> None:
    client = Client()
    found = False

    async for item in client.search(item_ids=[TEST_ITEM.id]):
        if item.name == TEST_ITEM.name and item.id == TEST_ITEM.id:
            found = True

    assert found
예제 #2
0
async def test_query_search() -> None:
    client = Client()
    found = False

    async for item in client.search(query=TEST_ITEM.name):
        if item.name == TEST_ITEM.name and item.id == TEST_ITEM.id:
            found = True

    assert found
예제 #3
0
async def test_wearable_search() -> None:
    client = Client()
    found = False

    async for item in client.search(query=TEST_ITEM.name,
                                    species_id=TEST_PET.species,
                                    color_id=TEST_PET.color):
        if item.name == TEST_ITEM.name and item.id == TEST_ITEM.id:
            found = True

    assert found
예제 #4
0
async def test_query_exact_search_multiple() -> None:
    client = Client()

    result_ids = []

    async for item in client.search(
            item_names=[TEST_ITEM.name, TEST_ITEM_TWO.name]):
        result_ids.append(item.id)

    found = TEST_ITEM.id in result_ids and TEST_ITEM_TWO.id in result_ids

    assert found
예제 #5
0
async def test_statefulness() -> None:
    client = Client()
    found = False

    async for item in client.search(query=TEST_ITEM.name):
        if item.name == TEST_ITEM.name and item.id == TEST_ITEM.id:
            found = True

    pet = await client.fetch_neopet(color=TEST_PET.color,
                                    species=TEST_PET.species)

    assert found and pet
예제 #6
0
async def test_item_id_search_broken() -> None:
    client = Client()

    with pytest.raises(InvalidItemID):
        async for item in client.search(item_ids=[1]):
            print(item)
예제 #7
0
async def main():
    dti_client = Client()
    async for item in dti_client.search(item_ids=[81162]):
        print(item)