#NEWLINE# def test_filepathfield_folders( self ) : #NEWLINE# #INDENT# path = ( os . path . abspath ( os . path . join ( upath ( __file__ ) , '..' , '..' ) ) + '/tests/filepath_test_files/' ) #NEWLINE# f = FilePathField ( path = path , allow_folders = True , allow_files = False ) #NEWLINE# f . choices . sort ( ) #NEWLINE# expected = [ ( '/forms_tests/tests/filepath_test_files/directory' , 'directory' ) ] #NEWLINE# actual = fix_os_paths ( f . choices ) #NEWLINE# self . assertEqual ( len ( expected ) , len ( actual ) ) #NEWLINE# for ( exp , got ) in zip ( expected , actual ) : #NEWLINE# #INDENT# self . assertEqual ( exp [ 1 ] , got [ 1 ] ) #NEWLINE# self . assertTrue ( got [ 0 ] . endswith ( exp [ 0 ] ) ) #NEWLINE# #UNINDENT# f = FilePathField ( path = path , allow_folders = True , allow_files = True ) #NEWLINE# f . choices . sort ( ) #NEWLINE# expected = [ ( '/forms_tests/tests/filepath_test_files/.dot-file' , '.dot-file' ) , ( '/forms_tests/tests/filepath_test_files/1x1.bmp' , '1x1.bmp' ) , ( '/forms_tests/tests/filepath_test_files/1x1.png' , '1x1.png' ) , ( '/forms_tests/tests/filepath_test_files/directory' , 'directory' ) , ( '/forms_tests/tests/filepath_test_files/fake-image.jpg' , 'fake-image.jpg' ) , ( '/forms_tests/tests/filepath_test_files/real-text-file.txt' , 'real-text-file.txt' ) ] #NEWLINE# actual = fix_os_paths ( f . choices ) #NEWLINE# self . assertEqual ( len ( expected ) , len ( actual ) ) #NEWLINE# for ( exp , got ) in zip ( expected , actual ) : #NEWLINE# #INDENT# self . assertEqual ( exp [ 1 ] , got [ 1 ] ) #NEWLINE# self . assertTrue ( got [ 0 ] . endswith ( exp [ 0 ] ) )