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

Support dynamically_convert_elements_to_models also for accessing members of #220

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

Comments

@github-actions
Copy link

github-actions bot commented Nov 9, 2024

omnipy-wrapped pydantic models

# TODO: Support dynamically_convert_elements_to_models also for accessing members of

from typing import Annotated

import pytest

from helpers.protocols import AssertModelOrValFunc
from omnipy.modules.remote.datasets import HttpUrlDataset


def test_http_url_dataset(
        assert_model_if_dyn_conv_else_val: Annotated[AssertModelOrValFunc, pytest.fixture]) -> None:
    urls = HttpUrlDataset()
    urls['url1'] = 'http://abc.net'  # type: ignore[assignment]
    urls['url2'] = 'https://user:[email protected]/def?ghi=jkl#mno'  # type: ignore[assignment]

    # TODO: Support dynamically_convert_elements_to_models also for accessing members of
    #       omnipy-wrapped pydantic models

    assert urls['url1'].host == 'abc.net'
    assert_model_if_dyn_conv_else_val(urls['url2'].query['ghi'], str, 'jkl')
@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