Issue #9850: Fixed macpath.join() for empty first component. Patch by
Oleg Oshmyan.
This commit is contained in:
commit
402e1e388d
|
@ -53,7 +53,7 @@ def join(s, *p):
|
||||||
colon = _get_colon(s)
|
colon = _get_colon(s)
|
||||||
path = s
|
path = s
|
||||||
for t in p:
|
for t in p:
|
||||||
if (not s) or isabs(t):
|
if (not path) or isabs(t):
|
||||||
path = t
|
path = t
|
||||||
continue
|
continue
|
||||||
if t[:1] == colon:
|
if t[:1] == colon:
|
||||||
|
|
|
@ -49,16 +49,40 @@ class MacPathTestCase(unittest.TestCase):
|
||||||
def test_join(self):
|
def test_join(self):
|
||||||
join = macpath.join
|
join = macpath.join
|
||||||
self.assertEqual(join('a', 'b'), ':a:b')
|
self.assertEqual(join('a', 'b'), ':a:b')
|
||||||
|
self.assertEqual(join(':a', 'b'), ':a:b')
|
||||||
|
self.assertEqual(join(':a:', 'b'), ':a:b')
|
||||||
|
self.assertEqual(join(':a::', 'b'), ':a::b')
|
||||||
|
self.assertEqual(join(':a', '::b'), ':a::b')
|
||||||
|
self.assertEqual(join('a', ':'), ':a:')
|
||||||
|
self.assertEqual(join('a:', ':'), 'a:')
|
||||||
|
self.assertEqual(join('a', ''), ':a:')
|
||||||
|
self.assertEqual(join('a:', ''), 'a:')
|
||||||
|
self.assertEqual(join('', ''), '')
|
||||||
self.assertEqual(join('', 'a:b'), 'a:b')
|
self.assertEqual(join('', 'a:b'), 'a:b')
|
||||||
|
self.assertEqual(join('', 'a', 'b'), ':a:b')
|
||||||
self.assertEqual(join('a:b', 'c'), 'a:b:c')
|
self.assertEqual(join('a:b', 'c'), 'a:b:c')
|
||||||
self.assertEqual(join('a:b', ':c'), 'a:b:c')
|
self.assertEqual(join('a:b', ':c'), 'a:b:c')
|
||||||
self.assertEqual(join('a', ':b', ':c'), ':a:b:c')
|
self.assertEqual(join('a', ':b', ':c'), ':a:b:c')
|
||||||
|
self.assertEqual(join('a', 'b:'), 'b:')
|
||||||
|
self.assertEqual(join('a:', 'b:'), 'b:')
|
||||||
|
|
||||||
self.assertEqual(join(b'a', b'b'), b':a:b')
|
self.assertEqual(join(b'a', b'b'), b':a:b')
|
||||||
|
self.assertEqual(join(b':a', b'b'), b':a:b')
|
||||||
|
self.assertEqual(join(b':a:', b'b'), b':a:b')
|
||||||
|
self.assertEqual(join(b':a::', b'b'), b':a::b')
|
||||||
|
self.assertEqual(join(b':a', b'::b'), b':a::b')
|
||||||
|
self.assertEqual(join(b'a', b':'), b':a:')
|
||||||
|
self.assertEqual(join(b'a:', b':'), b'a:')
|
||||||
|
self.assertEqual(join(b'a', b''), b':a:')
|
||||||
|
self.assertEqual(join(b'a:', b''), b'a:')
|
||||||
|
self.assertEqual(join(b'', b''), b'')
|
||||||
self.assertEqual(join(b'', b'a:b'), b'a:b')
|
self.assertEqual(join(b'', b'a:b'), b'a:b')
|
||||||
|
self.assertEqual(join(b'', b'a', b'b'), b':a:b')
|
||||||
self.assertEqual(join(b'a:b', b'c'), b'a:b:c')
|
self.assertEqual(join(b'a:b', b'c'), b'a:b:c')
|
||||||
self.assertEqual(join(b'a:b', b':c'), b'a:b:c')
|
self.assertEqual(join(b'a:b', b':c'), b'a:b:c')
|
||||||
self.assertEqual(join(b'a', b':b', b':c'), b':a:b:c')
|
self.assertEqual(join(b'a', b':b', b':c'), b':a:b:c')
|
||||||
|
self.assertEqual(join(b'a', b'b:'), b'b:')
|
||||||
|
self.assertEqual(join(b'a:', b'b:'), b'b:')
|
||||||
|
|
||||||
def test_splitext(self):
|
def test_splitext(self):
|
||||||
splitext = macpath.splitext
|
splitext = macpath.splitext
|
||||||
|
|
|
@ -145,6 +145,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9850: Fixed macpath.join() for empty first component. Patch by
|
||||||
|
Oleg Oshmyan.
|
||||||
|
|
||||||
- Issue #5309: distutils' build and build_ext commands now accept a ``-j``
|
- Issue #5309: distutils' build and build_ext commands now accept a ``-j``
|
||||||
option to enable parallel building of extension modules.
|
option to enable parallel building of extension modules.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue