uranusjr commented on a change in pull request #19608:
URL: https://github.com/apache/airflow/pull/19608#discussion_r779292509
##########
File path: tests/decorators/test_python.py
##########
@@ -112,13 +114,18 @@ 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}
+ @parameterized.expand([["dict"], ["dict[str, int]"], ["Dict"], ["Dict[str,
int]"]])
+ def test_infer_multiple_outputs_using_dict_typing(self,
test_return_annotation):
+ if sys.version_info < (3, 9) and test_return_annotation == "dict[str,
int]":
+ self.skipTest("dict[...] not a supported typing prior to Python
3.9")
+
+ @task_decorator
+ def identity_dict(x: int, y: int) -> eval(test_return_annotation):
+ return {"x": x, "y": y}
Review comment:
Looks like `typing.get_type_hints()` does the eval automatically and can
be useful here (to replace `inspect.signature`).
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]