Python ntpath.expandvars() Examples
The following are 18
code examples of ntpath.expandvars().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ntpath
, or try the search function
.
Example #1
Source File: test_ntpath.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
Example #2
Source File: test_ntpath.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
Example #3
Source File: test_ntpath.py From android_universal with MIT License | 6 votes |
def test_expandvars_nonascii(self): def check(value, expected): tester('ntpath.expandvars(%r)' % value, expected) with support.EnvironmentVarGuard() as env: env.clear() nonascii = support.FS_NONASCII env['spam'] = nonascii env[nonascii] = 'ham' + nonascii check('$spam bar', '%s bar' % nonascii) check('$%s bar' % nonascii, '$%s bar' % nonascii) check('${spam}bar', '%sbar' % nonascii) check('${%s}bar' % nonascii, 'ham%sbar' % nonascii) check('$spam}bar', '%s}bar' % nonascii) check('$%s}bar' % nonascii, '$%s}bar' % nonascii) check('%spam% bar', '%s bar' % nonascii) check('%{}% bar'.format(nonascii), 'ham%s bar' % nonascii) check('%spam%bar', '%sbar' % nonascii) check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
Example #4
Source File: test_ntpath.py From android_universal with MIT License | 6 votes |
def test_expandvars(self): with support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
Example #5
Source File: test_ntpath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
Example #6
Source File: test_ntpath.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_expandvars_nonascii(self): def check(value, expected): tester('ntpath.expandvars(%r)' % value, expected) with support.EnvironmentVarGuard() as env: env.clear() nonascii = support.FS_NONASCII env['spam'] = nonascii env[nonascii] = 'ham' + nonascii check('$spam bar', '%s bar' % nonascii) check('$%s bar' % nonascii, '$%s bar' % nonascii) check('${spam}bar', '%sbar' % nonascii) check('${%s}bar' % nonascii, 'ham%sbar' % nonascii) check('$spam}bar', '%s}bar' % nonascii) check('$%s}bar' % nonascii, '$%s}bar' % nonascii) check('%spam% bar', '%s bar' % nonascii) check('%{}% bar'.format(nonascii), 'ham%s bar' % nonascii) check('%spam%bar', '%sbar' % nonascii) check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
Example #7
Source File: test_ntpath.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_expandvars(self): with support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
Example #8
Source File: test_ntpath.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_expandvars_nonascii(self): encoding = sys.getfilesystemencoding() def check(value, expected): tester0("ntpath.expandvars(%r)" % value, expected) tester0("ntpath.expandvars(%r)" % value.decode(encoding), expected.decode(encoding)) with test_support.EnvironmentVarGuard() as env: env.clear() unonascii = test_support.FS_NONASCII snonascii = unonascii.encode(encoding) env['spam'] = snonascii env[snonascii] = 'ham' + snonascii check('$spam bar', '%s bar' % snonascii) check('$%s bar' % snonascii, '$%s bar' % snonascii) check('${spam}bar', '%sbar' % snonascii) check('${%s}bar' % snonascii, 'ham%sbar' % snonascii) check('$spam}bar', '%s}bar' % snonascii) check('$%s}bar' % snonascii, '$%s}bar' % snonascii) check('%spam% bar', '%s bar' % snonascii) check('%{}% bar'.format(snonascii), 'ham%s bar' % snonascii) check('%spam%bar', '%sbar' % snonascii) check('%{}%bar'.format(snonascii), 'ham%sbar' % snonascii)
Example #9
Source File: test_ntpath.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
Example #10
Source File: test_ntpath.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_expandvars_nonascii(self): def check(value, expected): tester('ntpath.expandvars(%r)' % value, expected) with support.EnvironmentVarGuard() as env: env.clear() nonascii = support.FS_NONASCII env['spam'] = nonascii env[nonascii] = 'ham' + nonascii check('$spam bar', '%s bar' % nonascii) check('$%s bar' % nonascii, '$%s bar' % nonascii) check('${spam}bar', '%sbar' % nonascii) check('${%s}bar' % nonascii, 'ham%sbar' % nonascii) check('$spam}bar', '%s}bar' % nonascii) check('$%s}bar' % nonascii, '$%s}bar' % nonascii) check('%spam% bar', '%s bar' % nonascii) check('%{}% bar'.format(nonascii), 'ham%s bar' % nonascii) check('%spam%bar', '%sbar' % nonascii) check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
Example #11
Source File: test_ntpath.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_expandvars(self): with support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
Example #12
Source File: test_ntpath.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_expandvars_nonascii(self): def check(value, expected): tester('ntpath.expandvars(%r)' % value, expected) with support.EnvironmentVarGuard() as env: env.clear() nonascii = support.FS_NONASCII env['spam'] = nonascii env[nonascii] = 'ham' + nonascii check('$spam bar', '%s bar' % nonascii) check('$%s bar' % nonascii, '$%s bar' % nonascii) check('${spam}bar', '%sbar' % nonascii) check('${%s}bar' % nonascii, 'ham%sbar' % nonascii) check('$spam}bar', '%s}bar' % nonascii) check('$%s}bar' % nonascii, '$%s}bar' % nonascii) check('%spam% bar', '%s bar' % nonascii) check('%{}% bar'.format(nonascii), 'ham%s bar' % nonascii) check('%spam%bar', '%sbar' % nonascii) check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
Example #13
Source File: test_ntpath.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_expandvars(self): with support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
Example #14
Source File: test_ntpath.py From oss-ftp with MIT License | 6 votes |
def test_expandvars_nonascii(self): encoding = sys.getfilesystemencoding() def check(value, expected): tester0("ntpath.expandvars(%r)" % value, expected) tester0("ntpath.expandvars(%r)" % value.decode(encoding), expected.decode(encoding)) with test_support.EnvironmentVarGuard() as env: env.clear() unonascii = test_support.FS_NONASCII snonascii = unonascii.encode(encoding) env['spam'] = snonascii env[snonascii] = 'ham' + snonascii check('$spam bar', '%s bar' % snonascii) check('$%s bar' % snonascii, '$%s bar' % snonascii) check('${spam}bar', '%sbar' % snonascii) check('${%s}bar' % snonascii, 'ham%sbar' % snonascii) check('$spam}bar', '%s}bar' % snonascii) check('$%s}bar' % snonascii, '$%s}bar' % snonascii) check('%spam% bar', '%s bar' % snonascii) check('%{}% bar'.format(snonascii), 'ham%s bar' % snonascii) check('%spam%bar', '%sbar' % snonascii) check('%{}%bar'.format(snonascii), 'ham%sbar' % snonascii)
Example #15
Source File: test_ntpath.py From oss-ftp with MIT License | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
Example #16
Source File: test_ntpath.py From BinderFilter with MIT License | 6 votes |
def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() env["foo"] = "bar" env["{foo"] = "baz1" env["{foo}"] = "baz2" tester('ntpath.expandvars("foo")', "foo") tester('ntpath.expandvars("$foo bar")', "bar bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar") tester('ntpath.expandvars("$bar bar")', "$bar bar") tester('ntpath.expandvars("$?bar")', "$?bar") tester('ntpath.expandvars("${foo}bar")', "barbar") tester('ntpath.expandvars("$foo}bar")', "bar}bar") tester('ntpath.expandvars("${foo")', "${foo") tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") tester('ntpath.expandvars("%foo% bar")', "bar bar") tester('ntpath.expandvars("%foo%bar")', "barbar") tester('ntpath.expandvars("%foo%%foo%")', "barbar") tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") tester('ntpath.expandvars("%?bar%")', "%?bar%") tester('ntpath.expandvars("%foo%%bar")', "bar%bar") tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
Example #17
Source File: test_ntpath.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_expandvars_nonascii(self): encoding = sys.getfilesystemencoding() def check(value, expected): tester0("ntpath.expandvars(%r)" % value, expected) tester0("ntpath.expandvars(%r)" % value.decode(encoding), expected.decode(encoding)) with test_support.EnvironmentVarGuard() as env: env.clear() unonascii = test_support.FS_NONASCII snonascii = unonascii.encode(encoding) env['spam'] = snonascii env[snonascii] = 'ham' + snonascii check('$spam bar', '%s bar' % snonascii) check('$%s bar' % snonascii, '$%s bar' % snonascii) check('${spam}bar', '%sbar' % snonascii) check('${%s}bar' % snonascii, 'ham%sbar' % snonascii) check('$spam}bar', '%s}bar' % snonascii) check('$%s}bar' % snonascii, '$%s}bar' % snonascii) check('%spam% bar', '%s bar' % snonascii) check('%{}% bar'.format(snonascii), 'ham%s bar' % snonascii) check('%spam%bar', '%sbar' % snonascii) check('%{}%bar'.format(snonascii), 'ham%sbar' % snonascii)
Example #18
Source File: test_ntpath.py From android_universal with MIT License | 5 votes |
def test_path_expandvars(self): self.assertPathEqual(self.path.expandvars)