tests/introspection/test_is_union_origin.py
raw| 1 | import types |
| 2 | import typing |
| 3 | from typing import Any |
| 4 | |
| 5 | import pytest |
| 6 | import typing_extensions |
| 7 | |
| 8 | from typing_inspection.introspection import is_union_origin |
| 9 | |
| 10 | unions: list[Any] = [ |
| 11 | typing.Union, |
| 12 | typing_extensions.Union, |
| 13 | types.UnionType, |
| 14 | ] |
| 15 | |
| 16 | |
| 17 | @pytest.mark.parametrize( |
| 18 | 'union', |
| 19 | unions, |
| 20 | ) |
| 21 | def test_is_union_origin(union: Any) -> None: |
| 22 | assert is_union_origin(union) |