code: def set_dummy_app():
      """
      Return a context manager that makes sure that this dummy application is
      active. This is important, because we need an `Application` with
      `is_done=False` flag, otherwise no keys will be processed.
      """
      with create_pipe_input() as pipe_input:
          app = Application(
              layout=Layout(Window()),
              output=DummyOutput(),
              input=pipe_input,
          )
  
          # Don't start background tasks for these tests. The `KeyProcessor`
          # wants to create a background task for flushing keys. We can ignore it
          # here for these tests.
          # This patch is not clean. In the future, when we can use Taskgroups,
          # the `Application` should pass its task group to the constructor of
          # `KeyProcessor`. That way, it doesn't have to do a lookup using
          # `get_app()`.
          app.create_background_task = lambda *_, **kw: None
  
          with set_app(app):
              yield
  
imports: from __future__ import annotations
  from contextlib import contextmanager
  import pytest
  from prompt_toolkit.application import Application
  from prompt_toolkit.application.current import set_app
  from prompt_toolkit.input.defaults import create_pipe_input
  from prompt_toolkit.key_binding.key_bindings import KeyBindings
  from prompt_toolkit.key_binding.key_processor import KeyPress, KeyProcessor
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.layout import Layout, Window
  from prompt_toolkit.output import DummyOutput
label_desc: Use image node_id 1 for calling a global function with example usage: set_dummy_app() without return types