code: def test_threaded_in_memory_history():
      # Threaded in memory history is not useful. But testing it anyway, just to
      # see whether everything plays nicely together.
      history = ThreadedHistory(InMemoryHistory())
      history.append_string("hello")
      history.append_string("world")
  
      # Newest should yield first.
      assert _call_history_load(history) == ["world", "hello"]
  
      # Test another call.
      assert _call_history_load(history) == ["world", "hello"]
  
      history.append_string("test3")
      assert _call_history_load(history) == ["test3", "world", "hello"]
  
      # Passing history as a parameter.
      history2 = ThreadedHistory(InMemoryHistory(["abc", "def"]))
      assert _call_history_load(history2) == ["def", "abc"]
  
imports: from __future__ import annotations
  from asyncio import run
  from prompt_toolkit.history import FileHistory, InMemoryHistory, ThreadedHistory
label_desc: Use image node_id 5 for calling a global function with example usage: test_threaded_in_memory_history() without return types