Skip to content

Commit

Permalink
Limit PEP 604 test by Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Taragolis committed Jan 11, 2024
1 parent afc67ac commit ba656f3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/decorators/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def t1() -> TypeDictClass:

assert t1().operator.multiple_outputs is True

def test_infer_multiple_outputs_union_type(self):
# We do not enable `from __future__ import annotations` for particular this test module,
# that mean `str | None` annotation would raise TypeError in Python 3.9 and below
@pytest.mark.skipif(sys.version_info < (3, 10), reason="PEP 604 is implemented in Python 3.10")
def test_infer_multiple_outputs_pep_604_union_type(self):
@task_decorator
def t1() -> str | None:
# Before PEP 604 which are implemented in Python 3.10 `str | None`
Expand All @@ -120,6 +123,13 @@ def t1() -> str | None:

assert t1().operator.multiple_outputs is False

def test_infer_multiple_outputs_union_type(self):
@task_decorator
def t1() -> Union[str, None]:
return "foo"

assert t1().operator.multiple_outputs is False

def test_infer_multiple_outputs_forward_annotation(self):
if TYPE_CHECKING:

Expand Down

0 comments on commit ba656f3

Please sign in to comment.