code: def test_pathcompleter_can_apply_file_filter():
      # setup: create a test dir with 10 files
      test_dir = tempfile.mkdtemp()
      write_test_files(test_dir)
  
      # add a .csv file
      with open(os.path.join(test_dir, "my.csv"), "wb") as out:
          out.write(b"")
  
      file_filter = lambda f: f and f.endswith(".csv")
  
      with chdir(test_dir):
          completer = PathCompleter(file_filter=file_filter)
          doc_text = ""
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          result = [c.text for c in completions]
          assert ["my.csv"] == result
  
      # cleanup
      shutil.rmtree(test_dir)
  
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 10 for calling a global function with example usage: test_pathcompleter_can_apply_file_filter() without return types