def test_one(): """ main.py: Test defaults with local directory as input. """ main.main([get_anchorhub_path() + get_path_separator() + '../sample/multi-file', get_anchorhub_path() + get_path_separator() + 'tests/anchorhub-out', '-r'])
def test_one(): """ main.py: Test defaults with local directory as input. """ main.main([ get_anchorhub_path() + get_path_separator() + '../sample/multi-file', get_anchorhub_path() + get_path_separator() + 'tests/anchorhub-out', '-r' ])
def test_add_is_file(): """ normalize_opts.py: Test add_is_file() """ dir = get_anchorhub_path() a = {'input': dir, 'output': 'anchorhub-out'} n.add_is_dir(a) assert 'is_dir' in a assert a['is_dir'] == True file = get_anchorhub_path() + get_path_separator() + 'main.py' b = {'input': file, 'output': 'anchorhub-out'} n.add_is_dir(b) assert 'is_dir' in b assert b['is_dir'] == False
def test_get_file_list_dir_recursive(): # path to this file's directory d = get_anchorhub_path() + sep + 'tests' + sep abs_input = d + 'test_data' + sep abs_output = d + 'anchorhub-out' + sep extensions = ['.md', '.markdown'] recursive = True is_dir = True a = FileObj(abs_input=abs_input, abs_output=abs_output, extensions=extensions, recursive=recursive, is_dir=is_dir) l = get_file_list(a) expected_files = [ d + 'test_data' + sep + 'file1.md', d + 'test_data' + sep + 'file2.markdown', d + 'test_data' + sep + 'dir' + sep + 'file4.md', d + 'test_data' + sep + 'dir' + sep + 'file5.markdown' ] assert len(l) == len(expected_files) for f in expected_files: assert f in l
def test_get_anchorhub_path_directory(): """ getanchorhubpath.py: Make sure directory given is named 'anchorhub' """ path = get_anchorhub_path() dir = path[path.rfind(get_path_separator()) + 1:] assert dir == 'anchorhub'
def test_get_file_list_single(): # path to this file's directory d = get_anchorhub_path() + sep + 'tests' + sep abs_input = d + 'test_data' + sep + 'file2.markdown' abs_output = d + 'anchorhub-out' + sep extensions = ['.md', '.markdown'] recursive = False is_dir = False a = FileObj(input=abs_input, abs_input=abs_input, abs_output=abs_output, extensions=extensions, recursive=recursive, is_dir=is_dir) l = get_file_list(a) expected_files = [ d + 'test_data' + sep + 'file2.markdown' ] assert len(l) == len(expected_files) for f in expected_files: assert f in l
def test_file_to_list_basic(): sep = get_path_separator() path = get_anchorhub_path() + sep + 'lib' + sep + 'tests' + sep + \ 'test_data' + sep + 'filelist' assert FileToList.to_list(path) == ['Hello!\n', 'My name\n', 'is\n', \ 'AnchorHub']