You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/07/29 09:12:28 UTC

[airflow] branch main updated: Add missing import in best-practices code example (#25391)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9febd7f242 Add missing import in best-practices code example (#25391)
9febd7f242 is described below

commit 9febd7f242bfaa600857891052a8900528c0e576
Author: Madison Swain-Bowden <bo...@spu.edu>
AuthorDate: Fri Jul 29 02:12:21 2022 -0700

    Add missing import in best-practices code example (#25391)
    
    * Add missing import in best-practices code example
    
    This PR adds a missing import to the "unit test for a custom operator" code example. While this code example won't run on its own any way since `MyCustomOperator` isn't defined (and probably shouldn't be for simplicity), I noticed when applying this code to my own custom operator that an import for `DAG` was missing. This PR adds that back in, so the only missing import is for the user-added custom operator.
---
 docs/apache-airflow/best-practices.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/apache-airflow/best-practices.rst b/docs/apache-airflow/best-practices.rst
index f4acc7006c..fe4dab0614 100644
--- a/docs/apache-airflow/best-practices.rst
+++ b/docs/apache-airflow/best-practices.rst
@@ -273,6 +273,7 @@ It's easier to grab the concept with an example. Let's say that we have the foll
 .. code-block:: python
 
     from datetime import datetime
+
     from airflow import DAG
     from airflow.decorators import task
     from airflow.exceptions import AirflowException
@@ -479,10 +480,11 @@ This is an example test want to verify the structure of a code-generated DAG aga
 .. code-block:: python
 
     import datetime
-    import pendulum
 
+    import pendulum
     import pytest
 
+    from airflow import DAG
     from airflow.utils.state import DagRunState, TaskInstanceState
     from airflow.utils.types import DagRunType