code: def test_pathcompleter_respects_completions_under_min_input_len():
      # setup: create a test dir with 10 files
      test_dir = tempfile.mkdtemp()
      write_test_files(test_dir)
  
      # min len:1 and no text
      with chdir(test_dir):
          completer = PathCompleter(min_input_len=1)
          doc_text = ""
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          assert [] == completions
  
      # min len:1 and text of len 1
      with chdir(test_dir):
          completer = PathCompleter(min_input_len=1)
          doc_text = "1"
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          result = [c.text for c in completions]
          assert [""] == result
  
      # min len:0 and text of len 2
      with chdir(test_dir):
          completer = PathCompleter(min_input_len=0)
          doc_text = "1"
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          result = [c.text for c in completions]
          assert [""] == result
  
      # create 10 files with a 2 char long name
      for i in range(10):
          with open(os.path.join(test_dir, str(i) * 2), "wb") as out:
              out.write(b"")
  
      # min len:1 and text of len 1
      with chdir(test_dir):
          completer = PathCompleter(min_input_len=1)
          doc_text = "2"
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          result = sorted(c.text for c in completions)
          assert ["", "2"] == result
  
      # min len:2 and text of len 1
      with chdir(test_dir):
          completer = PathCompleter(min_input_len=2)
          doc_text = "2"
          doc = Document(doc_text, len(doc_text))
          event = CompleteEvent()
          completions = list(completer.get_completions(doc, event))
          assert [] == completions
  
      # cleanup
      shutil.rmtree(test_dir)
  
file_path: catboost/contrib/python/prompt-toolkit/py2/tests/test_contrib.py
imports: from __future__ import unicode_literals, absolute_import, print_function
  import os
  import shutil
  import tempfile
  from contextlib import contextmanager
  from six import text_type
  from prompt_toolkit.completion import CompleteEvent
  from prompt_toolkit.document import Document
  from prompt_toolkit.contrib.completers.filesystem import PathCompleter
label_desc: Use image node_id 7 for calling a global function with example usage: test_pathcompleter_respects_completions_under_min_input_len() without return types