def test_listdir_method_should_return_all_files_in_dir_ordered(self): expected_files = [ '1.1', '1.2', 'a.txt', 'b.txt', 'c.txt', 'arquivo1', 'arquivo2', 'arquivo3', 'data.dat' ] result = util.listdir(_get_test_data_dir()) assert len(result) == len(expected_files) for filepath in result: assert os.path.basename(filepath) in expected_files
def test_listdir_method_should_return_files_ordered_by_given_function( self): expected_files = [ '1.1', 'arquivo1', '1.2', 'arquivo2', 'arquivo3', 'data.dat', 'a.txt', 'b.txt', 'c.txt' ] result = util.listdir(_get_test_data_dir(), f_sort=_path_sort) assert len(result) == len(expected_files) for i in range(len(result)): assert os.path.basename(result[i]) == expected_files[i]
def test_listdir_method_should_return_some_files_in_dir_02(self): expected_files = ['data.dat'] result = util.listdir(_get_test_data_dir(), r'^\w+\.dat$') assert len(result) == len(expected_files) for filepath in result: assert os.path.basename(filepath) in expected_files
def test_listdir_method_should_return_some_files_in_dir_01(self): expected_files = ['1.1', '1.2', 'a.txt', 'b.txt', 'c.txt'] result = util.listdir(_get_test_data_dir(), r'^\w\.\w+$') assert len(result) == len(expected_files) for filepath in result: assert os.path.basename(filepath) in expected_files
def test_listdir_method_should_accept_3_args(self): util.listdir('.', r'.*', _path_sort)
def test_listdir_method_should_accept_2_args(self): util.listdir('.', r'.*')
def _get_cotahist_file_paths(s_data_dir): return fileutils.listdir(s_data_dir, r'COTAHIST_A[\d]{4}\.txt$')