code: def test_word_completer_dynamic_word_list():
      called = [0]
  
      def get_words():
          called[0] += 1
          return ["abc", "def", "aaa"]
  
      completer = WordCompleter(get_words)
  
      # Dynamic list on empty input.
      completions = completer.get_completions(
          Document(""), CompleteEvent()
      )
      assert [c.text for c in completions] == ["abc", "def", "aaa"]
      assert called[0] == 1
  
      # Static list on non-empty input.
      completions = completer.get_completions(
          Document("a"), CompleteEvent()
      )
      assert [c.text for c in completions] == ["abc", "aaa"]
      assert called[0] == 2
  
imports: from __future__ import annotations
  import os
  import re
  import shutil
  import tempfile
  from contextlib import contextmanager
  from prompt_toolkit.completion import CompleteEvent, FuzzyWordCompleter, NestedCompleter, PathCompleter, WordCompleter, merge_completers
  from prompt_toolkit.document import Document
label_desc: Use image node_id 16 for calling a global function with example usage: test_word_completer_dynamic_word_list() and returns: list