#NEWLINE# def test_pathcompleter_can_apply_file_filter( self ) : #NEWLINE# #INDENT# test_dir = tempfile . mkdtemp ( ) #NEWLINE# write_test_files ( test_dir ) #NEWLINE# with open ( os . path . join ( test_dir , 'my.csv' ) , 'wb' ) as out : #NEWLINE# #INDENT# out . write ( b'' ) #NEWLINE# #UNINDENT# file_filter = ( lambda f : ( f and f . endswith ( '.csv' ) ) ) #NEWLINE# with chdir ( test_dir ) : #NEWLINE# #INDENT# completer = PathCompleter ( file_filter = file_filter ) #NEWLINE# doc_text = '' #NEWLINE# doc = Document ( doc_text , len ( doc_text ) ) #NEWLINE# event = CompleteEvent ( ) #NEWLINE# completions = list ( completer . get_completions ( doc , completions ) ) #NEWLINE# result = [ c . text for c in completions ] #NEWLINE# self . assertEqual ( [ 'my.csv' ] , result ) #NEWLINE# #UNINDENT# shutil . rmtree ( test_dir )