File: test_is_union_origin.py

package info (click to toggle)
python-typing-inspection 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 384 kB
  • sloc: python: 1,120; makefile: 33; sh: 6
file content (25 lines) | stat: -rw-r--r-- 437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys
import types
import typing
from typing import Any

import pytest
import typing_extensions

from typing_inspection.introspection import is_union_origin

unions: list[Any] = [
    typing.Union,
    typing_extensions.Union,
]

if sys.version_info >= (3, 10):
    unions.append(types.UnionType)


@pytest.mark.parametrize(
    'union',
    unions,
)
def test_is_union_origin(union: Any) -> None:
    assert is_union_origin(union)