dondaum commented on code in PR #62164:
URL: https://github.com/apache/airflow/pull/62164#discussion_r2945651706


##########
airflow-core/tests/unit/models/test_dagcode.py:
##########
@@ -210,3 +212,20 @@ def mytask():
         DagCode.update_source_code(dag.dag_id, dag.fileloc)
         dag_code3 = DagCode.get_latest_dagcode(dag.dag_id)
         assert dag_code3.source_code_hash != 2
+
+    @pytest.mark.parametrize(
+        ("dag_exists", "expectation"),
+        [
+            (True, nullcontext()),
+            (False, pytest.raises(DagCodeNotFound)),
+        ],
+    )
+    def test_get_code_from_db(self, session, dag_exists, expectation):
+        """Test DagCode is returned from db."""
+        example_dag = 
make_example_dags(example_dags_module).get("example_bash_operator")
+        if dag_exists:
+            sync_dag_to_db(example_dag)
+        with expectation:
+            result = DagCode._get_code_from_db(example_dag.dag_id)
+            if dag_exists:
+                assert result is not None

Review Comment:
   Thanks for having a look at it. Changed.



-- 
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]

Reply via email to