Lines Matching refs:ntpath
1 import ntpath
18 tester('ntpath.splitext("foo.ext")', ('foo', '.ext'))
19 tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext'))
20 tester('ntpath.splitext(".ext")', ('.ext', ''))
21 tester('ntpath.splitext("\\foo.ext\\foo")', ('\\foo.ext\\foo', ''))
22 tester('ntpath.splitext("foo.ext\\")', ('foo.ext\\', ''))
23 tester('ntpath.splitext("")', ('', ''))
24 tester('ntpath.splitext("foo.bar.ext")', ('foo.bar', '.ext'))
25 tester('ntpath.splitext("xx/foo.bar.ext")', ('xx/foo.bar', '.ext'))
26 tester('ntpath.splitext("xx\\foo.bar.ext")', ('xx\\foo.bar', '.ext'))
27 tester('ntpath.splitext("c:a/b\\c.d")', ('c:a/b\\c', '.d'))
30 tester('ntpath.splitdrive("c:\\foo\\bar")',
32 tester('ntpath.splitdrive("c:/foo/bar")',
36 tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")',
38 tester('ntpath.splitunc("//conky/mountpoint/foo/bar")',
42 tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
43 tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")',
46 tester('ntpath.split("c:\\")', ('c:\\', ''))
47 tester('ntpath.split("\\\\conky\\mountpoint\\")',
50 tester('ntpath.split("c:/")', ('c:/', ''))
51 tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint', ''))
54 tester('ntpath.isabs("c:\\")', 1)
55 tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
56 tester('ntpath.isabs("\\foo")', 1)
57 tester('ntpath.isabs("\\foo\\bar")', 1)
60 tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
62 tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
64 tester('ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])',
68 tester('ntpath.join("")', '')
69 tester('ntpath.join("", "", "")', '')
70 tester('ntpath.join("a")', 'a')
71 tester('ntpath.join("/a")', '/a')
72 tester('ntpath.join("\\a")', '\\a')
73 tester('ntpath.join("a:")', 'a:')
74 tester('ntpath.join("a:", "b")', 'a:b')
75 tester('ntpath.join("a:", "/b")', 'a:/b')
76 tester('ntpath.join("a:", "\\b")', 'a:\\b')
77 tester('ntpath.join("a", "/b")', '/b')
78 tester('ntpath.join("a", "\\b")', '\\b')
79 tester('ntpath.join("a", "b", "c")', 'a\\b\\c')
80 tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c')
81 tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c')
82 tester('ntpath.join("a", "b", "\\c")', '\\c')
83 tester('ntpath.join("d:\\", "\\pleep")', 'd:\\pleep')
84 tester('ntpath.join("d:\\", "a", "b")', 'd:\\a\\b')
85 tester("ntpath.join('c:', '/a')", 'c:/a')
86 tester("ntpath.join('c:/', '/a')", 'c:/a')
87 tester("ntpath.join('c:/a', '/b')", '/b')
88 tester("ntpath.join('c:', 'd:/')", 'd:/')
89 tester("ntpath.join('c:/', 'd:/')", 'd:/')
90 tester("ntpath.join('c:/', 'd:/a/b')", 'd:/a/b')
92 tester("ntpath.join('')", '')
93 tester("ntpath.join('', '', '', '', '')", '')
94 tester("ntpath.join('a')", 'a')
95 tester("ntpath.join('', 'a')", 'a')
96 tester("ntpath.join('', '', '', '', 'a')", 'a')
97 tester("ntpath.join('a', '')", 'a\\')
98 tester("ntpath.join('a', '', '', '', '')", 'a\\')
99 tester("ntpath.join('a\\', '')", 'a\\')
100 tester("ntpath.join('a\\', '', '', '', '')", 'a\\')
103 tester("ntpath.normpath('A//////././//.//B')", r'A\B')
104 tester("ntpath.normpath('A/./B')", r'A\B')
105 tester("ntpath.normpath('A/foo/../B')", r'A\B')
106 tester("ntpath.normpath('C:A//B')", r'C:A\B')
107 tester("ntpath.normpath('D:A/./B')", r'D:A\B')
108 tester("ntpath.normpath('e:A/foo/../B')", r'e:A\B')
110 tester("ntpath.normpath('C:///A//B')", r'C:\A\B')
111 tester("ntpath.normpath('D:///A/./B')", r'D:\A\B')
112 tester("ntpath.normpath('e:///A/foo/../B')", r'e:\A\B')
114 tester("ntpath.normpath('..')", r'..')
115 tester("ntpath.normpath('.')", r'.')
116 tester("ntpath.normpath('')", r'.')
117 tester("ntpath.normpath('/')", '\\')
118 tester("ntpath.normpath('c:/')", 'c:\\')
119 tester("ntpath.normpath('/../.././..')", '\\')
120 tester("ntpath.normpath('c:/../../..')", 'c:\\')
121 tester("ntpath.normpath('../.././..')", r'..\..\..')
122 tester("ntpath.normpath('K:../.././..')", r'K:..\..\..')
123 tester("ntpath.normpath('C:////a/b')", r'C:\a\b')
124 tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b')
126 tester("ntpath.normpath('\\\\.\\NUL')", r'\\.\NUL')
127 tester("ntpath.normpath('\\\\?\\D:/XY\\Z')", r'\\?\D:/XY\Z')
135 tester('ntpath.expandvars("foo")', "foo")
136 tester('ntpath.expandvars("$foo bar")', "bar bar")
137 tester('ntpath.expandvars("${foo}bar")', "barbar")
138 tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar")
139 tester('ntpath.expandvars("$bar bar")', "$bar bar")
140 tester('ntpath.expandvars("$?bar")', "$?bar")
141 tester('ntpath.expandvars("${foo}bar")', "barbar")
142 tester('ntpath.expandvars("$foo}bar")', "bar}bar")
143 tester('ntpath.expandvars("${foo")', "${foo")
144 tester('ntpath.expandvars("${{foo}}")', "baz1}")
145 tester('ntpath.expandvars("$foo$foo")', "barbar")
146 tester('ntpath.expandvars("$bar$bar")', "$bar$bar")
147 tester('ntpath.expandvars("%foo% bar")', "bar bar")
148 tester('ntpath.expandvars("%foo%bar")', "barbar")
149 tester('ntpath.expandvars("%foo%%foo%")', "barbar")
150 tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar")
151 tester('ntpath.expandvars("%?bar%")', "%?bar%")
152 tester('ntpath.expandvars("%foo%%bar")', "bar%bar")
153 tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
156 # ntpath.abspath() can only be used on a system with the "nt" module
158 # the rest of the tests for the ntpath module to be run to completion
166 ntpath.abspath
168 tester('ntpath.abspath("C:\\")', "C:\\")
172 tester('ntpath.relpath("a")', 'a')
173 tester('ntpath.relpath(os.path.abspath("a"))', 'a')
174 tester('ntpath.relpath("a/b")', 'a\\b')
175 tester('ntpath.relpath("../a/b")', '..\\a\\b')
176 tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
177 tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b')
178 tester('ntpath.relpath("a", "b/c")', '..\\..\\a')
179 tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a')
180 tester('ntpath.relpath("a", "a")', '.')
181 tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat')
182 tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat')
183 tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat')
184 tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..')
185 tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat')
186 tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x')
187 tester('ntpath.relpath("/", "/")', '.')
188 tester('ntpath.relpath("/a", "/a")', '.')
189 tester('ntpath.relpath("/a/b", "/a/b")', '.')
190 tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
194 pathmodule = ntpath