code: def test_terminated(self):
      # create instance
      ec2_hook = EC2Hook()
      instance_id = self._create_instance(ec2_hook)
      # start instance
      ec2_hook.get_instance(instance_id=instance_id).start()
  
      # stop sensor, waits until ec2 instance state became terminated
      stop_sensor = EC2InstanceStateSensor(
          task_id="stop_sensor",
          target_state="terminated",
          instance_id=instance_id,
      )
      # assert instance state is not terminated
      assert not stop_sensor.poke(None)
      # stop instance
      ec2_hook.get_instance(instance_id=instance_id).terminate()
      # assert instance state is terminated
      assert stop_sensor.poke(None)
  
file_path: airflow/tests/providers/amazon/aws/sensors/test_ec2.py
imports: from __future__ import annotations
  import pytest
  from moto import mock_ec2
  from airflow.exceptions import TaskDeferred
  from airflow.providers.amazon.aws.hooks.ec2 import EC2Hook
  from airflow.providers.amazon.aws.sensors.ec2 import EC2InstanceStateSensor
label_desc: Use image node_id 6 for calling the TestEC2InstanceStateSensor obj's underlying member method code with example usage: obj.test_terminated() without return types