@@ -28,16 +28,16 @@ def test_identity_pass(self):
2828 val_name = 'values'
2929 out = to_list (num_exp , values , val_name )
3030 self .assertEqual (values , out )
31-
31+
3232 def test_one_to_list (self ):
33- """When input is a string or list with one element, it returns a list
33+ """When input is a string or list with one element, it returns a list
3434 with the expected number of elments repeated"""
3535 num_exp = 3
3636 values = 'hi'
3737 val_name = 'values'
3838 out = to_list (num_exp , values , val_name )
3939 self .assertEqual (['hi' , 'hi' , 'hi' ], out )
40-
40+
4141 values = ['ha' ]
4242 out = to_list (num_exp , values , val_name )
4343 self .assertEqual (['ha' , 'ha' , 'ha' ], out )
@@ -47,11 +47,11 @@ def test_list_wrong_length_fail(self):
4747 num_exp = 3
4848 values = ['1' , '2' ]
4949 val_name = 'values'
50-
50+
5151 with self .assertLogs ('climada.util.files_handler' , level = 'ERROR' ) as cm :
5252 to_list (num_exp , values , val_name )
5353 self .assertIn ("Provide one or 3 values." , cm .output [0 ])
54-
54+
5555class TestGetFileNames (unittest .TestCase ):
5656 """ Test get_file_names function. Only works with actually existing
5757 files and directories. """
@@ -68,13 +68,13 @@ def test_several_file_copy(self):
6868 self .assertEqual (file_name , out )
6969
7070 def test_folder_contents (self ):
71- """If input is one folder name, return a list with containg files.
71+ """If input is one folder name, return a list with containg files.
7272 Folder names are not contained."""
7373 file_name = os .path .join (DATA_DIR , 'demo' )
7474 out = get_file_names (file_name )
7575 for file in out :
7676 self .assertEqual ('.' , os .path .splitext (file )[1 ][0 ])
77-
77+
7878 file_name = DATA_DIR
7979 out = get_file_names (file_name )
8080 for file in out :
@@ -84,14 +84,14 @@ def test_globbing(self):
8484 """ If input is a glob pattern, return a list of matching visible
8585 files; omit folders.
8686 """
87- file_name = os .path .join (DATA_DIR , 'demo/ ' )
88- out = get_file_names (file_name + '*' )
87+ file_name = os .path .join (DATA_DIR , 'demo' )
88+ out = get_file_names (file_name )
8989
9090 tmp_files = os .listdir (file_name )
91- tmp_files = [file_name + f for f in tmp_files ]
91+ tmp_files = [os . path . join ( file_name , f ) for f in tmp_files ]
9292 tmp_files = [f for f in tmp_files if not os .path .isdir (f )
9393 and not os .path .basename (os .path .normpath (f )).startswith ('.' )]
94-
94+
9595 self .assertEqual (len (tmp_files ), len (out ))
9696 self .assertEqual (sorted (tmp_files ), sorted (out ))
9797
0 commit comments