MCPcopy Index your code
hub / github.com/python/cpython / test_join

Method test_join

Lib/test/test_ntpath.py:313–392  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311 "/home/swen/spam")
312
313 def test_join(self):
314 tester('ntpath.join("")', '')
315 tester('ntpath.join("", "", "")', '')
316 tester('ntpath.join("a")', 'a')
317 tester('ntpath.join("/a")', '/a')
318 tester('ntpath.join("\\a")', '\\a')
319 tester('ntpath.join("a:")', 'a:')
320 tester('ntpath.join("a:", "\\b")', 'a:\\b')
321 tester('ntpath.join("a", "\\b")', '\\b')
322 tester('ntpath.join("a", "b", "c")', 'a\\b\\c')
323 tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c')
324 tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c')
325 tester('ntpath.join("a", "b", "c\\")', 'a\\b\\c\\')
326 tester('ntpath.join("a", "b", "\\c")', '\\c')
327 tester('ntpath.join("d:\\", "\\pleep")', 'd:\\pleep')
328 tester('ntpath.join("d:\\", "a", "b")', 'd:\\a\\b')
329
330 tester("ntpath.join('', 'a')", 'a')
331 tester("ntpath.join('', '', '', '', 'a')", 'a')
332 tester("ntpath.join('a', '')", 'a\\')
333 tester("ntpath.join('a', '', '', '', '')", 'a\\')
334 tester("ntpath.join('a\\', '')", 'a\\')
335 tester("ntpath.join('a\\', '', '', '', '')", 'a\\')
336 tester("ntpath.join('a/', '')", 'a/')
337
338 tester("ntpath.join('a/b', 'x/y')", 'a/b\\x/y')
339 tester("ntpath.join('/a/b', 'x/y')", '/a/b\\x/y')
340 tester("ntpath.join('/a/b/', 'x/y')", '/a/b/x/y')
341 tester("ntpath.join('c:', 'x/y')", 'c:x/y')
342 tester("ntpath.join('c:a/b', 'x/y')", 'c:a/b\\x/y')
343 tester("ntpath.join('c:a/b/', 'x/y')", 'c:a/b/x/y')
344 tester("ntpath.join('c:/', 'x/y')", 'c:/x/y')
345 tester("ntpath.join('c:/a/b', 'x/y')", 'c:/a/b\\x/y')
346 tester("ntpath.join('c:/a/b/', 'x/y')", 'c:/a/b/x/y')
347 tester("ntpath.join('//computer/share', 'x/y')", '//computer/share\\x/y')
348 tester("ntpath.join('//computer/share/', 'x/y')", '//computer/share/x/y')
349 tester("ntpath.join('//computer/share/a/b', 'x/y')", '//computer/share/a/b\\x/y')
350
351 tester("ntpath.join('a/b', '/x/y')", '/x/y')
352 tester("ntpath.join('/a/b', '/x/y')", '/x/y')
353 tester("ntpath.join('c:', '/x/y')", 'c:/x/y')
354 tester("ntpath.join('c:a/b', '/x/y')", 'c:/x/y')
355 tester("ntpath.join('c:/', '/x/y')", 'c:/x/y')
356 tester("ntpath.join('c:/a/b', '/x/y')", 'c:/x/y')
357 tester("ntpath.join('//computer/share', '/x/y')", '//computer/share/x/y')
358 tester("ntpath.join('//computer/share/', '/x/y')", '//computer/share/x/y')
359 tester("ntpath.join('//computer/share/a', '/x/y')", '//computer/share/x/y')
360
361 tester("ntpath.join('c:', 'C:x/y')", 'C:x/y')
362 tester("ntpath.join('c:a/b', 'C:x/y')", 'C:a/b\\x/y')
363 tester("ntpath.join('c:/', 'C:x/y')", 'C:/x/y')
364 tester("ntpath.join('c:/a/b', 'C:x/y')", 'C:/a/b\\x/y')
365
366 for x in ('', 'a/b', '/a/b', 'c:', 'c:a/b', 'c:/', 'c:/a/b',
367 '//computer/share', '//computer/share/', '//computer/share/a/b'):
368 for y in ('d:', 'd:x/y', 'd:/', 'd:/x/y',
369 '//machine/common', '//machine/common/', '//machine/common/x/y'):
370 tester("ntpath.join(%r, %r)" % (x, y), y)

Callers

nothing calls this directly

Calls 1

testerFunction · 0.85

Tested by

no test coverage detected