示例#1
0
def test_ref_path_symlinks_relative(fs):
    src = 'foo/bar/baz'
    dest = 'whatever/hello'
    fs.create_symlink('/cwd/whatever', '/cwd/foo/meh')
    fs.cwd = '/cwd'
    assert href_path(src, dest) == '../meh/hello'
示例#2
0
def test_ref_path_same_file():
    src = 'foo/bar'
    dest = 'foo/bar'
    assert href_path(src, dest) == 'bar'
示例#3
0
def test_ref_path_absolute_to_relative(fs):
    src = '/somewhere/beta/file'
    dest = 'foo/bar'
    fs.cwd = '/somewhere/alpha'
    assert href_path(src, dest) == '../alpha/foo/bar'
示例#4
0
def test_ref_path_symlinks(fs):
    src = '/foo/bar/baz'
    dest = '/whatever/hello'
    fs.create_symlink('/whatever', '/foo/meh')
    assert href_path(src, dest) == '../meh/hello'
示例#5
0
def test_ref_path_child():
    src = 'foo'
    dest = 'foo/bar'
    assert href_path(src, dest) == 'foo/bar'
示例#6
0
def test_ref_path_parent():
    src = 'foo/bar'
    dest = 'foo'
    assert href_path(src, dest) == '.'
示例#7
0
def test_ref_path_root_is_only_common_ancestor_relative(fs):
    src = 'foo/bar'
    dest = 'baz/meh'
    fs.cwd = '/'
    assert href_path(src, dest) == '../baz/meh'
示例#8
0
def test_ref_path_root_is_only_common_ancestor():
    src = '/foo/bar'
    dest = '/baz/meh'
    assert href_path(src, dest) == '../baz/meh'
示例#9
0
def test_ref_path_common_ancestor():
    src = 'foo/bar/baz'
    dest = 'foo/meh'
    assert href_path(src, dest) == '../meh'
示例#10
0
def test_ref_path_sibling_descendant():
    src = 'foo/bar'
    dest = 'foo/baz/meh'
    assert href_path(src, dest) == 'baz/meh'
示例#11
0
def test_ref_path_same_dir():
    src = 'foo/bar'
    dest = 'foo/baz'
    assert href_path(src, dest) == 'baz'