code: def test_running(self):
      # create instance
      ec2_hook = EC2Hook()
      instance_id = self._create_instance(ec2_hook)
      # stop instance
      ec2_hook.get_instance(instance_id=instance_id).stop()
  
      # start sensor, waits until ec2 instance state became running
      start_sensor = EC2InstanceStateSensor(
          task_id="start_sensor",
          target_state="running",
          instance_id=instance_id,
      )
      # assert instance state is not running
      assert not start_sensor.poke(None)
      # start instance
      ec2_hook.get_instance(instance_id=instance_id).start()
      # assert instance state is running
      assert start_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 4 for calling the TestEC2InstanceStateSensor obj's underlying member method code with example usage: obj.test_running() without return types