docstr: Test the execute method raise TaskDeferred if running sensor in deferrable mode
docstr_tok: ["Test","the","execute","method","raise","TaskDeferred","if","running","sensor","in","deferrable","mode"]
code: def test_sensor_defer(self):
      """Test the execute method raise TaskDeferred if running sensor in deferrable mode"""
      sensor = EmrJobFlowSensor(
          task_id="test_task",
          poke_interval=0,
          job_flow_id="j-8989898989",
          aws_conn_id="aws_default",
          target_states=["RUNNING", "WAITING"],
          deferrable=True,
      )
  
      with patch.object(EmrJobFlowSensor, "poke", return_value=False):
          with pytest.raises(TaskDeferred) as exc:
              sensor.execute(context=None)
  
      assert isinstance(
          exc.value.trigger, EmrTerminateJobFlowTrigger
      ), f"{exc.value.trigger} is not a EmrTerminateJobFlowTrigger"
  
file_path: airflow/tests/providers/amazon/aws/sensors/test_emr_job_flow.py
imports: from __future__ import annotations
  import datetime
  from unittest import mock
  from unittest.mock import MagicMock, patch
  import pytest
  from dateutil.tz import tzlocal
  from airflow.exceptions import AirflowException, TaskDeferred
  from airflow.providers.amazon.aws.hooks.s3 import S3Hook
  from airflow.providers.amazon.aws.sensors.emr import EmrJobFlowSensor
  from airflow.providers.amazon.aws.triggers.emr import EmrTerminateJobFlowTrigger
label_desc: Use image node_id 4 for calling the TestEmrJobFlowSensor obj's underlying member method code with example usage: obj.test_sensor_defer() without return types