Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for synchronous task load_urls_into_new_dataset #219

Open
github-actions bot opened this issue Nov 9, 2024 · 0 comments
Open

Add test for synchronous task load_urls_into_new_dataset #219

github-actions bot opened this issue Nov 9, 2024 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Nov 9, 2024

# TODO: Add test for synchronous task `load_urls_into_new_dataset`

from dataclasses import dataclass

import pytest_cases as pc

from omnipy import BytesDataset, Dataset, JsonDataset, JsonDictDataset, StrDataset, TaskTemplate
from omnipy.modules.remote.tasks import (async_load_urls_into_new_dataset,
                                         get_bytes_from_api_endpoint,
                                         get_json_from_api_endpoint,
                                         get_str_from_api_endpoint)


@dataclass
class RequestTypeCase:
    job: TaskTemplate
    kwargs: dict[str, object]
    dataset_cls: type[Dataset]


@pc.case(tags='supports_external_session')
def case_get_json_from_api_endpoint() -> RequestTypeCase:
    return RequestTypeCase(get_json_from_api_endpoint, dict(), JsonDataset)


@pc.case(tags='supports_external_session')
def case_get_str_from_api_endpoint() -> RequestTypeCase:
    return RequestTypeCase(get_str_from_api_endpoint, dict(), StrDataset)


@pc.case(tags='supports_external_session')
def case_get_bytes_from_api_endpoint() -> RequestTypeCase:
    return RequestTypeCase(get_bytes_from_api_endpoint, dict(), BytesDataset)


@pc.case
def case_load_urls_into_new_dataset_default_json() -> RequestTypeCase:
    return RequestTypeCase(async_load_urls_into_new_dataset, dict(), JsonDataset)


@pc.case
def case_load_urls_into_new_dataset_other_dataset_cls() -> RequestTypeCase:
    return RequestTypeCase(
        async_load_urls_into_new_dataset,
        dict(dataset_cls=JsonDictDataset),
        JsonDictDataset,
    )


# TODO: Add test for synchronous task `load_urls_into_new_dataset`
@github-actions github-actions bot added the todo label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants