code: def test_previous_key_sequence(processor):
      """
      test whether we receive the correct previous_key_sequence.
      """
      with set_dummy_app():
          events = []
  
          def handler(event):
              events.append(event)
  
          # Build registry.
          registry = KeyBindings()
          registry.add("a", "a")(handler)
          registry.add("b", "b")(handler)
          processor = KeyProcessor(registry)
  
          # Create processor and feed keys.
          processor.feed(KeyPress("a", "a"))
          processor.feed(KeyPress("a", "a"))
          processor.feed(KeyPress("b", "b"))
          processor.feed(KeyPress("b", "b"))
          processor.process_keys()
  
          # Test.
          assert len(events) == 2
          assert len(events[0].key_sequence) == 2
          assert events[0].key_sequence[0].key == "a"
          assert events[0].key_sequence[0].data == "a"
          assert events[0].key_sequence[1].key == "a"
          assert events[0].key_sequence[1].data == "a"
          assert events[0].previous_key_sequence == []
  
          assert len(events[1].key_sequence) == 2
          assert events[1].key_sequence[0].key == "b"
          assert events[1].key_sequence[0].data == "b"
          assert events[1].key_sequence[1].key == "b"
          assert events[1].key_sequence[1].data == "b"
          assert len(events[1].previous_key_sequence) == 2
          assert events[1].previous_key_sequence[0].key == "a"
          assert events[1].previous_key_sequence[0].data == "a"
          assert events[1].previous_key_sequence[1].key == "a"
          assert events[1].previous_key_sequence[1].data == "a"
  
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 10 for calling a global function with example usage: test_previous_key_sequence(processor) without return types