turbaszek commented on a change in pull request #10587:
URL: https://github.com/apache/airflow/pull/10587#discussion_r506656027
##########
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'
+
+ def test_arg_not_set_fail(self):
+ @dag_decorator(default_args=self.DEFAULT_ARGS)
+ def noop_pipeline(value):
+ @task
+ def return_num(num):
+ return num
+
+ return_num(value)
+ with pytest.raises(TypeError):
+ noop_pipeline()
Review comment:
I'm not sure what exactly we are testing
----------------------------------------------------------------
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]