turbaszek commented on a change in pull request #10587:
URL: https://github.com/apache/airflow/pull/10587#discussion_r506655564
##########
File path: tests/models/test_dag.py
##########
@@ -1754,3 +1757,98 @@ def test_count_number_queries(self, tasks_count):
state=State.RUNNING,
execution_date=TEST_DATE,
)
+
+
+class TestDagDecorator:
+ DEFAULT_ARGS = {
+ "owner": "test",
+ "depends_on_past": True,
+ "start_date": timezone.utcnow(),
+ "retries": 1,
+ "retry_delay": timedelta(minutes=1),
+ }
+ DEFAULT_DATE = timezone.datetime(2016, 1, 1)
+ VALUE = 42
+
+ def setUp(self):
+ super().setUp()
+ self.operator = None
+
+ def tearDown(self):
+ super().tearDown()
+ clear_db_runs()
+
+ def test_set_dag_id(self):
+ @dag_decorator('test', default_args=self.DEFAULT_ARGS)
+ def noop_pipeline():
+ @task
+ def return_num(num):
+ return num
+
+ return_num(4)
+
+ assert noop_pipeline().dag_id, 'test'
Review comment:
Should we add test that asserts that the returned value is a `DAG`? This
will increase understanding imho
----------------------------------------------------------------
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]