uranusjr commented on code in PR #33406:
URL: https://github.com/apache/airflow/pull/33406#discussion_r1315460934


##########
tests/sensors/test_time_sensor.py:
##########
@@ -73,3 +73,16 @@ def test_target_time_aware(self):
             op = TimeSensorAsync(task_id="test", target_time=aware_time)
             assert hasattr(op.target_datetime.tzinfo, "offset")
             assert op.target_datetime.tzinfo.offset == 0
+
+    def test_target_time_naive_dag_timezone(self):
+        """
+        Tests that naive target_time gets converted correctly using the DAG's 
timezone.
+        """
+        with DAG(
+            "test_target_time_naive_dag_timezone",
+            start_date=pendulum.datetime(2020, 1, 1, 0, 0, 
tz=DEFAULT_TIMEZONE),
+        ):
+            op = TimeSensorAsync(task_id="test", target_time=pendulum.time(8, 
0))
+            assert op.target_datetime.time() == pendulum.time(0, 0)
+            assert hasattr(op.target_datetime.tzinfo, "offset")
+            assert op.target_datetime.tzinfo.offset == 0

Review Comment:
   I wonder if we should use a non-zero-offset timezone to make this more 
obvious.



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