turbaszek commented on a change in pull request #10349:
URL: https://github.com/apache/airflow/pull/10349#discussion_r471976937
##########
File path: tests/operators/test_python.py
##########
@@ -327,6 +328,103 @@ def
test_python_operator_python_callable_is_callable(self):
with pytest.raises(AirflowException):
task_decorator(not_callable, dag=self.dag)
+ def test_infer_multiple_outputs_using_typing(self):
+ @task_decorator
+ def identity_dict(x: int, y: int) -> Dict[str, int]:
+ return {"x": x, "y": y}
+
+ assert identity_dict(5, 5).operator.multiple_outputs is True #
pylint: disable=maybe-no-member
+
+ @task_decorator
+ def identity_tuple(x: int, y: int) -> Tuple[int, int]:
+ return x, y
+
+ assert identity_tuple(5, 5).operator.multiple_outputs is True #
pylint: disable=maybe-no-member
+
+ @task_decorator
+ def identity_int(x: int) -> int:
+ return x
+
+ assert identity_int(5).operator.multiple_outputs is False # pylint:
disable=maybe-no-member
+
+ @task_decorator
+ def identity_notyping(x: int):
+ return x
+
+ assert identity_notyping(5).operator.multiple_outputs is False #
pylint: disable=maybe-no-member
+
+ @conf_vars({("core", "enable_xcom_pickling"): "True"})
Review comment:
```suggestion
```
Let's remove it as pickle is not the default option. If the problem is with
`Set` then let's use `Tuple`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]