Пример #1
0
 def test_repath_backslash():
     home = os.path.expanduser('~')
     exp = os.listdir(home)
     exp = {p for p in exp if re.match(r'\w\w.*', p)}
     exp = {os.path.join(home, p) for p in exp}
     obs = set(regexpath(r'~/\w\w.*'))
     assert_equal(exp, obs)
Пример #2
0
 def test_repath_backslash():
     home = os.path.expanduser('~')
     exp = os.listdir(home)
     exp = {p for p in exp if re.match(r'\w\w.*', p)}
     exp = {os.path.join(home, p) for p in exp}
     obs = set(regexpath(r'~/\w\w.*'))
     assert_equal(exp, obs)
Пример #3
0
def test_repath_home_var_brace():
    exp = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=exp)
    obs = regexpath('${HOME}')
    assert_equal(1, len(os.environ))
    built_ins.ENV.undo_replace_env()
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])
Пример #4
0
def test_repath_home_var_brace():
    exp = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=exp)
    obs = regexpath('${HOME}')
    assert_equal(1, len(os.environ))
    built_ins.ENV.undo_replace_env()
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])
Пример #5
0
def test_repath_home_var():
    exp = os.path.expanduser("~")
    built_ins.ENV = Env(HOME=exp)
    obs = regexpath("$HOME")
    assert_equal(1, len(os.environ))
    built_ins.ENV.undo_replace_env()
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])
Пример #6
0
def test_repath_home_var_brace():
    if ON_WINDOWS:
        raise SkipTest
    exp = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=exp)
    with mock_xonsh_env(built_ins.ENV):
        obs = regexpath('${"HOME"}')
        assert_equal(1, len(obs))
        assert_equal(exp, obs[0])
Пример #7
0
def test_repath_home_var_brace():
    if ON_WINDOWS:
        raise SkipTest
    exp = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=exp)
    with mock_xonsh_env(built_ins.ENV):
        obs = regexpath('${"HOME"}')
        assert_equal(1, len(obs))
        assert_equal(exp, obs[0])
Пример #8
0
def test_repath_backslash():
    if ON_WINDOWS:
        raise SkipTest
    home = os.path.expanduser("~")
    exp = os.listdir(home)
    exp = {p for p in exp if re.match(r"\w\w.*", p)}
    exp = {os.path.join(home, p) for p in exp}
    obs = set(regexpath(r"~/\w\w.*"))
    assert_equal(exp, obs)
Пример #9
0
def test_repath_home_contents():
    if ON_WINDOWS:
        raise SkipTest
    home = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=home)
    with mock_xonsh_env(built_ins.ENV):
        exp = os.listdir(home)
        exp = {os.path.join(home, p) for p in exp}
        obs = set(regexpath('~/.*'))
        assert_equal(exp, obs)
Пример #10
0
def test_repath_home_contents():
    if ON_WINDOWS:
        raise SkipTest
    home = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=home)
    with mock_xonsh_env(built_ins.ENV):
        exp = os.listdir(home)
        exp = {os.path.join(home, p) for p in exp}
        obs = set(regexpath('~/.*'))
        assert_equal(exp, obs)
Пример #11
0
def test_repath_backslash():
    if ON_WINDOWS:
        raise SkipTest
    home = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=home)
    with mock_xonsh_env(built_ins.ENV):
        exp = os.listdir(home)
        exp = {p for p in exp if re.match(r'\w\w.*', p)}
        exp = {os.path.join(home, p) for p in exp}
        obs = set(regexpath(r'~/\w\w.*'))
        assert_equal(exp, obs)
Пример #12
0
def test_repath_backslash():
    if ON_WINDOWS:
        raise SkipTest
    home = os.path.expanduser('~')
    built_ins.ENV = Env(HOME=home)
    with mock_xonsh_env(built_ins.ENV):
        exp = os.listdir(home)
        exp = {p for p in exp if re.match(r'\w\w.*', p)}
        exp = {os.path.join(home, p) for p in exp}
        obs = set(regexpath(r'~/\w\w.*'))
        assert_equal(exp, obs)
Пример #13
0
def test_repath_home_contents():
    home = os.path.expanduser('~')
    exp = os.listdir(home)
    exp = {os.path.join(home, p) for p in exp}
    obs = set(regexpath('~/.*'))
    assert_equal(exp, obs)
Пример #14
0
def test_repath_home_itself():
    exp = os.path.expanduser('~')
    obs = regexpath('~')
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])
Пример #15
0
def test_repath_home_contents():
    home = os.path.expanduser('~')
    exp = os.listdir(home)
    exp = {os.path.join(home, p) for p in exp}
    obs = set(regexpath('~/.*'))
    assert_equal(exp, obs)
Пример #16
0
def test_repath_home_itself():
    exp = os.path.expanduser('~')
    obs = regexpath('~')
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])