def _get_file_paths(cmdargs): if 'files' not in cmdargs: return [] found_file_paths = find_vim_script(map(Path, cmdargs['files'])) return found_file_paths
def test_find_vim_script_by_given_no_file_paths(self): file_paths_to_find = [] got_file_paths = map(str, find_vim_script(file_paths_to_find)) expected_file_paths = [] self.assertEqual(set(expected_file_paths), set(got_file_paths))
def _get_file_paths(cmdargs): if 'files' not in cmdargs: return [] found_file_paths = find_vim_script(map(Path, cmdargs['files'])) return set(found_file_paths)
def test_find_vim_script_by_given_a_file_path(self): file_paths_to_find = [ get_fixture_path('1.vim'), ] got_file_paths = map(str, find_vim_script(file_paths_to_find)) expected_file_paths = map(str, map(get_fixture_path, [ '1.vim', ])) self.assertEqual(set(expected_file_paths), set(got_file_paths))
def test_find_vim_script_by_given_a_vim_script_unlinke_file_path(self): file_paths_to_find = [ # We should pass through when given Vim script unlike file path. # It makes checking a file on user-dependent naming policy # convinience. get_fixture_path('not_vim_script'), ] got_file_paths = map(str, find_vim_script(file_paths_to_find)) expected_file_paths = map(str, map(get_fixture_path, [ 'not_vim_script', ])) self.assertEqual(set(expected_file_paths), set(got_file_paths))
def test_find_vim_script_by_given_nested_dir(self): file_paths_to_find = [ FIXTURE_PATH_BASE, ] got_file_paths = map(str, find_vim_script(file_paths_to_find)) expected_file_paths = map(str, map(get_fixture_path, [ '.gvimrc', '.vimrc', '_gvimrc', '_vimrc', '1.vim', '2.vim', os.path.join('sub', '3.vim'), os.path.join('sub', '4.vim'), ])) self.assertEqual(set(expected_file_paths), set(got_file_paths))
def test_find_vim_script_by_given_nested_dir(self): file_paths_to_find = [ FIXTURE_PATH_BASE, ] got_file_paths = map(str, find_vim_script(file_paths_to_find)) expected_file_paths = map( str, map(get_fixture_path, [ '.gvimrc', '.vimrc', '_gvimrc', '_vimrc', '1.vim', '2.vim', os.path.join('sub', '3.vim'), os.path.join('sub', '4.vim'), ])) self.assertEqual(set(expected_file_paths), set(got_file_paths))