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

Revisit test_recursive_dict_model_with_none with new Python versions supporting ... #223

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

Comments

@github-actions
Copy link

pydantic v2

However new type syntax crashes pydantic.

# This for some reason cause a TypeError in Python 3.12. Probably related to PEP695,

# However new type syntax crashes pydantic.

class MyGenericOnlyTuplesAndScalarsModel(

Model[tuple[TypeVarStore[T]

| ForwardRef('MyGenericOnlyTuplesAndScalarsAlias[T]'),

...]],

Generic[T]):

...

# TODO: Revisit test_recursive_dict_model_with_none with new Python versions supporting PEP695 and

    ]


# TODO: Revisit test_recursive_dict_model_with_none with new Python versions supporting PEP695 and
#       pydantic v2


def test_recursive_generic_tuple_model_with_none() -> None:
    class MyGenericScalarModel(Model[T], Generic[T]):
        ...

    # if sys.version_info >= (3, 12):

    class MyGenericOnlyTuplesAndScalarsModel(
            Model[tuple[TypeVarStore[T]
                        | ForwardRef('MyGenericOnlyTuplesAndScalarsAlias'), ...]],
            Generic[T]):
        ...

    # else:
    #     # This for some reason cause a TypeError in Python 3.12. Probably related to PEP695,
    #     # However new type syntax crashes pydantic.
    #     class MyGenericOnlyTuplesAndScalarsModel(
    #             Model[tuple[TypeVarStore[T]
    #                         | ForwardRef('MyGenericOnlyTuplesAndScalarsAlias[T]'),
    #                         ...]],
    #             Generic[T]):
    #         ...

    MyGenericOnlyTuplesAndScalarsAlias: TypeAlias = \
        MyGenericScalarModel[T] | MyGenericOnlyTuplesAndScalarsModel[T]
@github-actions github-actions bot added the todo label Nov 12, 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