Lines Matching defs:ntpath

1 import ntpath
22 ntpath._getfinalpathname
48 return ntpath.normcase(os.fsdecode(path))
50 return tuple(ntpath.normcase(os.fsdecode(p)) for p in path)
90 tester('ntpath.splitext("foo.ext")', ('foo', '.ext'))
91 tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext'))
92 tester('ntpath.splitext(".ext")', ('.ext', ''))
93 tester('ntpath.splitext("\\foo.ext\\foo")', ('\\foo.ext\\foo', ''))
94 tester('ntpath.splitext("foo.ext\\")', ('foo.ext\\', ''))
95 tester('ntpath.splitext("")', ('', ''))
96 tester('ntpath.splitext("foo.bar.ext")', ('foo.bar', '.ext'))
97 tester('ntpath.splitext("xx/foo.bar.ext")', ('xx/foo.bar', '.ext'))
98 tester('ntpath.splitext("xx\\foo.bar.ext")', ('xx\\foo.bar', '.ext'))
99 tester('ntpath.splitext("c:a/b\\c.d")', ('c:a/b\\c', '.d'))
102 tester('ntpath.splitdrive("c:\\foo\\bar")',
104 tester('ntpath.splitdrive("c:/foo/bar")',
106 tester('ntpath.splitdrive("\\\\conky\\mountpoint\\foo\\bar")',
108 tester('ntpath.splitdrive("//conky/mountpoint/foo/bar")',
110 tester('ntpath.splitdrive("\\\\\\conky\\mountpoint\\foo\\bar")',
112 tester('ntpath.splitdrive("///conky/mountpoint/foo/bar")',
114 tester('ntpath.splitdrive("\\\\conky\\\\mountpoint\\foo\\bar")',
116 tester('ntpath.splitdrive("//conky//mountpoint/foo/bar")',
119 self.assertEqual(ntpath.splitdrive('//conky/MOUNTPOİNT/foo/bar'),
123 tester('ntpath.splitdrive("//?/c:")', ("//?/c:", ""))
124 tester('ntpath.splitdrive("//?/c:/")', ("//?/c:", "/"))
125 tester('ntpath.splitdrive("//?/c:/dir")', ("//?/c:", "/dir"))
126 tester('ntpath.splitdrive("//?/UNC")', ("//?/UNC", ""))
127 tester('ntpath.splitdrive("//?/UNC/")', ("//?/UNC/", ""))
128 tester('ntpath.splitdrive("//?/UNC/server/")', ("//?/UNC/server/", ""))
129 tester('ntpath.splitdrive("//?/UNC/server/share")', ("//?/UNC/server/share", ""))
130 tester('ntpath.splitdrive("//?/UNC/server/share/dir")', ("//?/UNC/server/share", "/dir"))
131 tester('ntpath.splitdrive("//?/VOLUME{00000000-0000-0000-0000-000000000000}/spam")',
133 tester('ntpath.splitdrive("//?/BootPartition/")', ("//?/BootPartition", "/"))
135 tester('ntpath.splitdrive("\\\\?\\c:")', ("\\\\?\\c:", ""))
136 tester('ntpath.splitdrive("\\\\?\\c:\\")', ("\\\\?\\c:", "\\"))
137 tester('ntpath.splitdrive("\\\\?\\c:\\dir")', ("\\\\?\\c:", "\\dir"))
138 tester('ntpath.splitdrive("\\\\?\\UNC")', ("\\\\?\\UNC", ""))
139 tester('ntpath.splitdrive("\\\\?\\UNC\\")', ("\\\\?\\UNC\\", ""))
140 tester('ntpath.splitdrive("\\\\?\\UNC\\server\\")', ("\\\\?\\UNC\\server\\", ""))
141 tester('ntpath.splitdrive("\\\\?\\UNC\\server\\share")', ("\\\\?\\UNC\\server\\share", ""))
142 tester('ntpath.splitdrive("\\\\?\\UNC\\server\\share\\dir")',
144 tester('ntpath.splitdrive("\\\\?\\VOLUME{00000000-0000-0000-0000-000000000000}\\spam")',
146 tester('ntpath.splitdrive("\\\\?\\BootPartition\\")', ("\\\\?\\BootPartition", "\\"))
149 tester('ntpath.splitdrive("//")', ("//", "")) # empty server & missing share
150 tester('ntpath.splitdrive("///")', ("///", "")) # empty server & empty share
151 tester('ntpath.splitdrive("///y")', ("///y", "")) # empty server & non-empty share
152 tester('ntpath.splitdrive("//x")', ("//x", "")) # non-empty server & missing share
153 tester('ntpath.splitdrive("//x/")', ("//x/", "")) # non-empty server & empty share
156 tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
157 tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")',
160 tester('ntpath.split("c:\\")', ('c:\\', ''))
161 tester('ntpath.split("\\\\conky\\mountpoint\\")',
164 tester('ntpath.split("c:/")', ('c:/', ''))
165 tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint/', ''))
168 tester('ntpath.isabs("c:\\")', 1)
169 tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
170 tester('ntpath.isabs("\\foo")', 1)
171 tester('ntpath.isabs("\\foo\\bar")', 1)
174 tester('ntpath.isabs("\\\\conky\\mountpoint")', 1)
175 tester('ntpath.isabs("\\\\.\\C:")', 1)
178 tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
180 tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
182 tester('ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])',
186 tester('ntpath.join("")', '')
187 tester('ntpath.join("", "", "")', '')
188 tester('ntpath.join("a")', 'a')
189 tester('ntpath.join("/a")', '/a')
190 tester('ntpath.join("\\a")', '\\a')
191 tester('ntpath.join("a:")', 'a:')
192 tester('ntpath.join("a:", "\\b")', 'a:\\b')
193 tester('ntpath.join("a", "\\b")', '\\b')
194 tester('ntpath.join("a", "b", "c")', 'a\\b\\c')
195 tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c')
196 tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c')
197 tester('ntpath.join("a", "b", "\\c")', '\\c')
198 tester('ntpath.join("d:\\", "\\pleep")', 'd:\\pleep')
199 tester('ntpath.join("d:\\", "a", "b")', 'd:\\a\\b')
201 tester("ntpath.join('', 'a')", 'a')
202 tester("ntpath.join('', '', '', '', 'a')", 'a')
203 tester("ntpath.join('a', '')", 'a\\')
204 tester("ntpath.join('a', '', '', '', '')", 'a\\')
205 tester("ntpath.join('a\\', '')", 'a\\')
206 tester("ntpath.join('a\\', '', '', '', '')", 'a\\')
207 tester("ntpath.join('a/', '')", 'a/')
209 tester("ntpath.join('a/b', 'x/y')", 'a/b\\x/y')
210 tester("ntpath.join('/a/b', 'x/y')", '/a/b\\x/y')
211 tester("ntpath.join('/a/b/', 'x/y')", '/a/b/x/y')
212 tester("ntpath.join('c:', 'x/y')", 'c:x/y')
213 tester("ntpath.join('c:a/b', 'x/y')", 'c:a/b\\x/y')
214 tester("ntpath.join('c:a/b/', 'x/y')", 'c:a/b/x/y')
215 tester("ntpath.join('c:/', 'x/y')", 'c:/x/y')
216 tester("ntpath.join('c:/a/b', 'x/y')", 'c:/a/b\\x/y')
217 tester("ntpath.join('c:/a/b/', 'x/y')", 'c:/a/b/x/y')
218 tester("ntpath.join('//computer/share', 'x/y')", '//computer/share\\x/y')
219 tester("ntpath.join('//computer/share/', 'x/y')", '//computer/share/x/y')
220 tester("ntpath.join('//computer/share/a/b', 'x/y')", '//computer/share/a/b\\x/y')
222 tester("ntpath.join('a/b', '/x/y')", '/x/y')
223 tester("ntpath.join('/a/b', '/x/y')", '/x/y')
224 tester("ntpath.join('c:', '/x/y')", 'c:/x/y')
225 tester("ntpath.join('c:a/b', '/x/y')", 'c:/x/y')
226 tester("ntpath.join('c:/', '/x/y')", 'c:/x/y')
227 tester("ntpath.join('c:/a/b', '/x/y')", 'c:/x/y')
228 tester("ntpath.join('//computer/share', '/x/y')", '//computer/share/x/y')
229 tester("ntpath.join('//computer/share/', '/x/y')", '//computer/share/x/y')
230 tester("ntpath.join('//computer/share/a', '/x/y')", '//computer/share/x/y')
232 tester("ntpath.join('c:', 'C:x/y')", 'C:x/y')
233 tester("ntpath.join('c:a/b', 'C:x/y')", 'C:a/b\\x/y')
234 tester("ntpath.join('c:/', 'C:x/y')", 'C:/x/y')
235 tester("ntpath.join('c:/a/b', 'C:x/y')", 'C:/a/b\\x/y')
241 tester("ntpath.join(%r, %r)" % (x, y), y)
243 tester("ntpath.join('\\\\computer\\share\\', 'a', 'b')", '\\\\computer\\share\\a\\b')
244 tester("ntpath.join('\\\\computer\\share', 'a', 'b')", '\\\\computer\\share\\a\\b')
245 tester("ntpath.join('\\\\computer\\share', 'a\\b')", '\\\\computer\\share\\a\\b')
246 tester("ntpath.join('//computer/share/', 'a', 'b')", '//computer/share/a\\b')
247 tester("ntpath.join('//computer/share', 'a', 'b')", '//computer/share\\a\\b')
248 tester("ntpath.join('//computer/share', 'a/b')", '//computer/share\\a/b')
251 tester("ntpath.normpath('A//////././//.//B')", r'A\B')
252 tester("ntpath.normpath('A/./B')", r'A\B')
253 tester("ntpath.normpath('A/foo/../B')", r'A\B')
254 tester("ntpath.normpath('C:A//B')", r'C:A\B')
255 tester("ntpath.normpath('D:A/./B')", r'D:A\B')
256 tester("ntpath.normpath('e:A/foo/../B')", r'e:A\B')
258 tester("ntpath.normpath('C:///A//B')", r'C:\A\B')
259 tester("ntpath.normpath('D:///A/./B')", r'D:\A\B')
260 tester("ntpath.normpath('e:///A/foo/../B')", r'e:\A\B')
262 tester("ntpath.normpath('..')", r'..')
263 tester("ntpath.normpath('.')", r'.')
264 tester("ntpath.normpath('')", r'.')
265 tester("ntpath.normpath('/')", '\\')
266 tester("ntpath.normpath('c:/')", 'c:\\')
267 tester("ntpath.normpath('/../.././..')", '\\')
268 tester("ntpath.normpath('c:/../../..')", 'c:\\')
269 tester("ntpath.normpath('../.././..')", r'..\..\..')
270 tester("ntpath.normpath('K:../.././..')", r'K:..\..\..')
271 tester("ntpath.normpath('C:////a/b')", r'C:\a\b')
272 tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b')
274 tester("ntpath.normpath('\\\\.\\NUL')", r'\\.\NUL')
275 tester("ntpath.normpath('\\\\?\\D:/XY\\Z')", r'\\?\D:/XY\Z')
276 tester("ntpath.normpath('handbook/../../Tests/image.png')", r'..\Tests\image.png')
277 tester("ntpath.normpath('handbook/../../../Tests/image.png')", r'..\..\Tests\image.png')
278 tester("ntpath.normpath('handbook///../a/.././../b/c')", r'..\b\c')
279 tester("ntpath.normpath('handbook/a/../..///../../b/c')", r'..\..\b\c')
281 tester("ntpath.normpath('//server/share/..')" , '\\\\server\\share\\')
282 tester("ntpath.normpath('//server/share/../')" , '\\\\server\\share\\')
283 tester("ntpath.normpath('//server/share/../..')", '\\\\server\\share\\')
284 tester("ntpath.normpath('//server/share/../../')", '\\\\server\\share\\')
287 tester("ntpath.normpath('\\\\foo\\\\')", '\\\\foo\\\\')
288 tester("ntpath.normpath('\\\\foo\\')", '\\\\foo\\')
289 tester("ntpath.normpath('\\\\foo')", '\\\\foo')
290 tester("ntpath.normpath('\\\\')", '\\\\')
293 expected = ntpath.normpath(os.getcwd())
294 tester("ntpath.realpath('.')", expected)
295 tester("ntpath.realpath('./.')", expected)
296 tester("ntpath.realpath('/'.join(['.'] * 100))", expected)
297 tester("ntpath.realpath('.\\.')", expected)
298 tester("ntpath.realpath('\\'.join(['.'] * 100))", expected)
301 expected = ntpath.normpath(os.getcwd())
302 tester("ntpath.realpath('..')", ntpath.dirname(expected))
303 tester("ntpath.realpath('../..')",
304 ntpath.dirname(ntpath.dirname(expected)))
305 tester("ntpath.realpath('/'.join(['..'] * 50))",
306 ntpath.splitdrive(expected)[0] + '\\')
307 tester("ntpath.realpath('..\\..')",
308 ntpath.dirname(ntpath.dirname(expected)))
309 tester("ntpath.realpath('\\'.join(['..'] * 50))",
310 ntpath.splitdrive(expected)[0] + '\\')
315 ABSTFN = ntpath.abspath(os_helper.TESTFN)
321 self.assertPathEqual(ntpath.realpath(ABSTFN + "1"), ABSTFN)
322 self.assertPathEqual(ntpath.realpath(os.fsencode(ABSTFN + "1")),
325 # gh-88013: call ntpath.realpath with binary drive name may raise a
329 if not ntpath.exists(d):
333 self.assertEqual(ntpath.realpath(d), d)
337 ntpath.realpath(os_helper.TESTFN + "\0spam", strict=False))
344 ABSTFN = ntpath.abspath(os_helper.TESTFN)
347 self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN, strict=True)
348 self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN + "2", strict=True)
350 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "\0spam", strict=True)
355 ABSTFN = ntpath.abspath(os_helper.TESTFN)
360 os.symlink(ABSTFN, ntpath.relpath(ABSTFN + "1"))
361 self.assertPathEqual(ntpath.realpath(ABSTFN + "1"), ABSTFN)
366 ABSTFN = ntpath.abspath(os_helper.TESTFN)
384 self.assertPathEqual(ntpath.realpath("broken"),
386 self.assertPathEqual(ntpath.realpath(r"broken\foo"),
390 self.assertPathEqual(ntpath.realpath(r"broken1"),
392 self.assertPathEqual(ntpath.realpath(r"broken1\baz"),
394 self.assertPathEqual(ntpath.realpath("broken2"),
396 self.assertPathEqual(ntpath.realpath("broken3"),
398 self.assertPathEqual(ntpath.realpath("broken4"),
400 self.assertPathEqual(ntpath.realpath("broken5"),
403 self.assertPathEqual(ntpath.realpath(b"broken"),
405 self.assertPathEqual(ntpath.realpath(rb"broken\foo"),
407 self.assertPathEqual(ntpath.realpath(rb"broken1"),
409 self.assertPathEqual(ntpath.realpath(rb"broken1\baz"),
411 self.assertPathEqual(ntpath.realpath(b"broken2"),
413 self.assertPathEqual(ntpath.realpath(rb"broken3"),
415 self.assertPathEqual(ntpath.realpath(b"broken4"),
417 self.assertPathEqual(ntpath.realpath(b"broken5"),
426 ABSTFN = ntpath.abspath(os_helper.TESTFN)
435 self.assertPathEqual(ntpath.realpath(ABSTFN), ABSTFN)
440 self.assertPathIn(ntpath.realpath(ABSTFN + "1"), expected)
441 self.assertPathIn(ntpath.realpath(ABSTFN + "2"), expected)
443 self.assertPathIn(ntpath.realpath(ABSTFN + "1\\x"),
444 (ntpath.join(r, "x") for r in expected))
445 self.assertPathEqual(ntpath.realpath(ABSTFN + "1\\.."),
446 ntpath.dirname(ABSTFN))
447 self.assertPathEqual(ntpath.realpath(ABSTFN + "1\\..\\x"),
448 ntpath.dirname(ABSTFN) + "\\x")
450 self.assertPathEqual(ntpath.realpath(ABSTFN + "1\\..\\"
451 + ntpath.basename(ABSTFN) + "y"),
453 self.assertPathIn(ntpath.realpath(ABSTFN + "1\\..\\"
454 + ntpath.basename(ABSTFN) + "1"),
457 os.symlink(ntpath.basename(ABSTFN) + "a\\b", ABSTFN + "a")
458 self.assertPathEqual(ntpath.realpath(ABSTFN + "a"), ABSTFN + "a")
460 os.symlink("..\\" + ntpath.basename(ntpath.dirname(ABSTFN))
461 + "\\" + ntpath.basename(ABSTFN) + "c", ABSTFN + "c")
462 self.assertPathEqual(ntpath.realpath(ABSTFN + "c"), ABSTFN + "c")
465 self.assertPathEqual(ntpath.realpath(ntpath.basename(ABSTFN)), ABSTFN)
471 ABSTFN = ntpath.abspath(os_helper.TESTFN)
480 self.assertRaises(OSError, ntpath.realpath, ABSTFN, strict=True)
484 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1", strict=True)
485 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "2", strict=True)
486 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\x", strict=True)
489 self.assertPathEqual(ntpath.realpath(ABSTFN + "1\\..", strict=True),
490 ntpath.dirname(ABSTFN))
491 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\..\\x", strict=True)
493 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\..\\"
494 + ntpath.basename(ABSTFN) + "y",
496 self.assertRaises(OSError, ntpath.realpath,
497 ABSTFN + "1\\..\\" + ntpath.basename(ABSTFN) + "1",
500 os.symlink(ntpath.basename(ABSTFN) + "a\\b", ABSTFN + "a")
501 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "a", strict=True)
503 os.symlink("..\\" + ntpath.basename(ntpath.dirname(ABSTFN))
504 + "\\" + ntpath.basename(ABSTFN) + "c", ABSTFN + "c")
505 self.assertRaises(OSError, ntpath.realpath, ABSTFN + "c", strict=True)
508 self.assertRaises(OSError, ntpath.realpath, ntpath.basename(ABSTFN),
514 ABSTFN = ntpath.abspath(os_helper.TESTFN)
528 self.assertPathEqual(ntpath.realpath(ABSTFN + "3link"),
530 self.assertPathEqual(ntpath.realpath(ABSTFN + "3.link"),
534 with open(ntpath.realpath(ABSTFN + "3link"), "rb") as f:
536 with open(ntpath.realpath(ABSTFN + "3.link"), "rb") as f:
540 self.assertPathEqual(ntpath.realpath("\\\\?\\" + ABSTFN + "3link"),
542 self.assertPathEqual(ntpath.realpath("\\\\?\\" + ABSTFN + "3.link"),
547 tester("ntpath.realpath('NUL')", r'\\.\NUL')
552 ABSTFN = ntpath.abspath(os_helper.TESTFN)
559 test_dir_long = ntpath.join(ABSTFN, "MyVeryLongDirectoryName")
563 test_file_long = ntpath.join(test_dir_long, "file.txt")
564 test_file_short = ntpath.join(test_dir_short, "file.txt")
569 self.assertPathEqual(test_file_long, ntpath.realpath(test_file_short))
572 self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
574 self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
576 self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
584 tester('ntpath.expandvars("foo")', "foo")
585 tester('ntpath.expandvars("$foo bar")', "bar bar")
586 tester('ntpath.expandvars("${foo}bar")', "barbar")
587 tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar")
588 tester('ntpath.expandvars("$bar bar")', "$bar bar")
589 tester('ntpath.expandvars("$?bar")', "$?bar")
590 tester('ntpath.expandvars("$foo}bar")', "bar}bar")
591 tester('ntpath.expandvars("${foo")', "${foo")
592 tester('ntpath.expandvars("${{foo}}")', "baz1}")
593 tester('ntpath.expandvars("$foo$foo")', "barbar")
594 tester('ntpath.expandvars("$bar$bar")', "$bar$bar")
595 tester('ntpath.expandvars("%foo% bar")', "bar bar")
596 tester('ntpath.expandvars("%foo%bar")', "barbar")
597 tester('ntpath.expandvars("%foo%%foo%")', "barbar")
598 tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar")
599 tester('ntpath.expandvars("%?bar%")', "%?bar%")
600 tester('ntpath.expandvars("%foo%%bar")', "bar%bar")
601 tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
602 tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
607 tester('ntpath.expandvars(%r)' % value, expected)
625 tester('ntpath.expanduser("test")', 'test')
629 tester('ntpath.expanduser("~test")', '~test')
634 tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
635 tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
638 tester('ntpath.expanduser("~test")', 'Users\\test')
639 tester('ntpath.expanduser("~")', 'Users\\eric')
644 tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
645 tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
646 tester('ntpath.expanduser("~test\\foo\\bar")',
648 tester('ntpath.expanduser("~test/foo/bar")',
650 tester('ntpath.expanduser("~\\foo\\bar")',
652 tester('ntpath.expanduser("~/foo/bar")',
660 tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
661 tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
668 tester('ntpath.expanduser("~test")', '~test')
669 tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
675 tester('ntpath.abspath("C:\\")', "C:\\")
676 tester('ntpath.abspath("\\\\?\\C:////spam////eggs. . .")', "\\\\?\\C:\\spam\\eggs")
677 tester('ntpath.abspath("\\\\.\\C:////spam////eggs. . .")', "\\\\.\\C:\\spam\\eggs")
678 tester('ntpath.abspath("//spam//eggs. . .")', "\\\\spam\\eggs")
679 tester('ntpath.abspath("\\\\spam\\\\eggs. . .")', "\\\\spam\\eggs")
680 tester('ntpath.abspath("C:/spam. . .")', "C:\\spam")
681 tester('ntpath.abspath("C:\\spam. . .")', "C:\\spam")
682 tester('ntpath.abspath("C:/nul")', "\\\\.\\nul")
683 tester('ntpath.abspath("C:\\nul")', "\\\\.\\nul")
684 tester('ntpath.abspath("//..")', "\\\\")
685 tester('ntpath.abspath("//../")', "\\\\..\\")
686 tester('ntpath.abspath("//../..")', "\\\\..\\")
687 tester('ntpath.abspath("//../../")', "\\\\..\\..\\")
688 tester('ntpath.abspath("//../../../")', "\\\\..\\..\\")
689 tester('ntpath.abspath("//../../../..")', "\\\\..\\..\\")
690 tester('ntpath.abspath("//../../../../")', "\\\\..\\..\\")
691 tester('ntpath.abspath("//server")', "\\\\server")
692 tester('ntpath.abspath("//server/")', "\\\\server\\")
693 tester('ntpath.abspath("//server/..")', "\\\\server\\")
694 tester('ntpath.abspath("//server/../")', "\\\\server\\..\\")
695 tester('ntpath.abspath("//server/../..")', "\\\\server\\..\\")
696 tester('ntpath.abspath("//server/../../")', "\\\\server\\..\\")
697 tester('ntpath.abspath("//server/../../..")', "\\\\server\\..\\")
698 tester('ntpath.abspath("//server/../../../")', "\\\\server\\..\\")
699 tester('ntpath.abspath("//server/share")', "\\\\server\\share")
700 tester('ntpath.abspath("//server/share/")', "\\\\server\\share\\")
701 tester('ntpath.abspath("//server/share/..")', "\\\\server\\share\\")
702 tester('ntpath.abspath("//server/share/../")', "\\\\server\\share\\")
703 tester('ntpath.abspath("//server/share/../..")', "\\\\server\\share\\")
704 tester('ntpath.abspath("//server/share/../../")', "\\\\server\\share\\")
705 tester('ntpath.abspath("C:\\nul. . .")', "\\\\.\\nul")
706 tester('ntpath.abspath("//... . .")', "\\\\")
707 tester('ntpath.abspath("//.. . . .")', "\\\\")
708 tester('ntpath.abspath("//../... . .")', "\\\\..\\")
709 tester('ntpath.abspath("//../.. . . .")', "\\\\..\\")
711 tester('ntpath.abspath("")', cwd_dir)
712 tester('ntpath.abspath(" ")', cwd_dir + "\\ ")
713 tester('ntpath.abspath("?")', cwd_dir + "\\?")
714 drive, _ = ntpath.splitdrive(cwd_dir)
715 tester('ntpath.abspath("/abc/")', drive + "\\abc")
718 tester('ntpath.relpath("a")', 'a')
719 tester('ntpath.relpath(ntpath.abspath("a"))', 'a')
720 tester('ntpath.relpath("a/b")', 'a\\b')
721 tester('ntpath.relpath("../a/b")', '..\\a\\b')
723 currentdir = ntpath.basename(cwd_dir)
724 tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
725 tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b')
726 tester('ntpath.relpath("a", "b/c")', '..\\..\\a')
727 tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat')
728 tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a')
729 tester('ntpath.relpath("a", "a")', '.')
730 tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat')
731 tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat')
732 tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat')
733 tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..')
734 tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat')
735 tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x')
736 tester('ntpath.relpath("/", "/")', '.')
737 tester('ntpath.relpath("/a", "/a")', '.')
738 tester('ntpath.relpath("/a/b", "/a/b")', '.')
739 tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
743 tester(('ntpath.commonpath(%r)' % paths).replace('\\\\', '\\'),
746 self.assertRaises(exc, ntpath.commonpath, paths)
747 self.assertRaises(exc, ntpath.commonpath,
750 self.assertRaises(ValueError, ntpath.commonpath, [])
797 self.assertRaises(TypeError, ntpath.commonpath,
799 self.assertRaises(TypeError, ntpath.commonpath,
801 self.assertRaises(TypeError, ntpath.commonpath,
803 self.assertRaises(TypeError, ntpath.commonpath,
805 self.assertRaises(TypeError, ntpath.commonpath,
807 self.assertRaises(TypeError, ntpath.commonpath,
814 self.assertTrue(ntpath.sameopenfile(tf1.fileno(), tf1.fileno()))
816 self.assertFalse(ntpath.sameopenfile(tf1.fileno(), tf2.fileno()))
822 ntpath.sameopenfile(-1, -1)
825 self.assertTrue(ntpath.ismount("c:\\"))
826 self.assertTrue(ntpath.ismount("C:\\"))
827 self.assertTrue(ntpath.ismount("c:/"))
828 self.assertTrue(ntpath.ismount("C:/"))
829 self.assertTrue(ntpath.ismount("\\\\.\\c:\\"))
830 self.assertTrue(ntpath.ismount("\\\\.\\C:\\"))
832 self.assertTrue(ntpath.ismount(b"c:\\"))
833 self.assertTrue(ntpath.ismount(b"C:\\"))
834 self.assertTrue(ntpath.ismount(b"c:/"))
835 self.assertTrue(ntpath.ismount(b"C:/"))
836 self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
837 self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
840 self.assertFalse(ntpath.ismount(d))
849 drive, path = ntpath.splitdrive(test_cwd)
851 self.assertFalse(ntpath.ismount(drive.lower()))
852 self.assertFalse(ntpath.ismount(drive.upper()))
854 self.assertTrue(ntpath.ismount("\\\\localhost\\c$"))
855 self.assertTrue(ntpath.ismount("\\\\localhost\\c$\\"))
857 self.assertTrue(ntpath.ismount(b"\\\\localhost\\c$"))
858 self.assertTrue(ntpath.ismount(b"\\\\localhost\\c$\\"))
873 path_drive = ntpath.splitdrive(path)[0]
874 volume_path_drive = ntpath.splitdrive(volume_path)[0]
895 pathmodule = ntpath
901 path = ntpath
916 self.assertEqual(ntpath.normcase('\u03a9\u2126'), 'ωΩ')