Skip to content

Check check_type(expected_type) parameter type #371

@douglas-raillard-arm

Description

@douglas-raillard-arm

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

If provided a broken input in expected_type, check_type() will assume all the checks passed. This is maybe on purpose to allow future evolutions of check_type() but it might be good to state it in the documentation that the default is to assume the type is correct.

Use case

I discovered that when I tried passsing a tuple of annotations, following the classinfo format of isinstance(foo, (str, int)). The correct equivalent input would be a typing.Union[str, int] (or typing.Union[(str, int)], so the tuple only needs to be wrapped with typing.Union).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions