Lee-W commented on code in PR #74483:
URL: https://github.com/apache/airflow/pull/74483#discussion_r4227821182


##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -6145,15 +6151,11 @@ def test_should_update_dag_next_dagruns_after_run_type(
             ti.state = "failed"
         session.flush()
 
-        check_mock = MagicMock()
-        self.job_runner._set_exceeds_max_active_runs = check_mock
-        with patch("airflow.models.dag.DagModel.calculate_dagrun_date_fields") 
as mock_calc:
-            self.job_runner._schedule_dag_run(
-                dag_run=run,
-                session=session,
-            )
-            assert not mock_calc.called
-        assert check_mock.called == expected
+        self.job_runner._schedule_dag_run(
+            dag_run=run,
+            session=session,
+        )
+        assert mock_set_exceeds_max_active_runs.called == expected

Review Comment:
   Nit: `.called` can't tell "called once" from "called twice". `expected` is a 
bool, so you can compare the count directly without branching:
   
   ```python
   assert mock_set_exceeds_max_active_runs.call_count == expected
   ```
   



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