Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 14
0
def test_repath_home_itself():
    exp = os.path.expanduser('~')
    obs = regexpath('~')
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])
Ejemplo n.º 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)
Ejemplo n.º 16
0
def test_repath_home_itself():
    exp = os.path.expanduser('~')
    obs = regexpath('~')
    assert_equal(1, len(obs))
    assert_equal(exp, obs[0])