@@ -126,53 +126,56 @@ def test_join(self):
126126 tester ('ntpath.join("/a")' , '/a' )
127127 tester ('ntpath.join("\\ a")' , '\\ a' )
128128 tester ('ntpath.join("a:")' , 'a:' )
129- tester ('ntpath.join("a:", "b")' , 'a:b' )
130- tester ('ntpath.join("a:", "/b")' , 'a:/b' )
131129 tester ('ntpath.join("a:", "\\ b")' , 'a:\\ b' )
132- tester ('ntpath.join("a", "/b")' , '/b' )
133130 tester ('ntpath.join("a", "\\ b")' , '\\ b' )
134131 tester ('ntpath.join("a", "b", "c")' , 'a\\ b\\ c' )
135132 tester ('ntpath.join("a\\ ", "b", "c")' , 'a\\ b\\ c' )
136133 tester ('ntpath.join("a", "b\\ ", "c")' , 'a\\ b\\ c' )
137134 tester ('ntpath.join("a", "b", "\\ c")' , '\\ c' )
138135 tester ('ntpath.join("d:\\ ", "\\ pleep")' , 'd:\\ pleep' )
139136 tester ('ntpath.join("d:\\ ", "a", "b")' , 'd:\\ a\\ b' )
140- tester ("ntpath.join('c:', '/a')" , 'c:/a' )
141- tester ("ntpath.join('c:/', '/a')" , 'c:/a' )
142- tester ("ntpath.join('c:/a', '/b')" , '/b' )
143- tester ("ntpath.join('c:', 'd:/')" , 'd:/' )
144- tester ("ntpath.join('c:/', 'd:/')" , 'd:/' )
145- tester ("ntpath.join('c:/', 'd:/a/b')" , 'd:/a/b' )
146-
147- tester ("ntpath.join('')" , '' )
148- tester ("ntpath.join('', '', '', '', '')" , '' )
149- tester ("ntpath.join('a')" , 'a' )
137+
150138 tester ("ntpath.join('', 'a')" , 'a' )
151139 tester ("ntpath.join('', '', '', '', 'a')" , 'a' )
152140 tester ("ntpath.join('a', '')" , 'a\\ ' )
153141 tester ("ntpath.join('a', '', '', '', '')" , 'a\\ ' )
154142 tester ("ntpath.join('a\\ ', '')" , 'a\\ ' )
155143 tester ("ntpath.join('a\\ ', '', '', '', '')" , 'a\\ ' )
156-
157- # from comment in ntpath.join
158- tester ("ntpath.join('c:', '/a')" , 'c:/a' )
159- tester ("ntpath.join('//computer/share', '/a')" , '//computer/share/a' )
160- tester ("ntpath.join('c:/', '/a')" , 'c:/a' )
161- tester ("ntpath.join('//computer/share/', '/a')" , '//computer/share/a' )
162- tester ("ntpath.join('c:/a', '/b')" , '/b' )
163- tester ("ntpath.join('//computer/share/a', '/b')" , '/b' )
164- tester ("ntpath.join('c:', 'd:/')" , 'd:/' )
165- tester ("ntpath.join('c:', '//computer/share/')" , '//computer/share/' )
166- tester ("ntpath.join('//computer/share', 'd:/')" , 'd:/' )
167- tester ("ntpath.join('//computer/share', '//computer/share/')" , '//computer/share/' )
168- tester ("ntpath.join('c:/', 'd:/')" , 'd:/' )
169- tester ("ntpath.join('c:/', '//computer/share/')" , '//computer/share/' )
170- tester ("ntpath.join('//computer/share/', 'd:/')" , 'd:/' )
171- tester ("ntpath.join('//computer/share/', '//computer/share/')" , '//computer/share/' )
172-
173- tester ("ntpath.join('c:', '//computer/share/')" , '//computer/share/' )
174- tester ("ntpath.join('c:/', '//computer/share/')" , '//computer/share/' )
175- tester ("ntpath.join('c:/', '//computer/share/a/b')" , '//computer/share/a/b' )
144+ tester ("ntpath.join('a/', '')" , 'a/' )
145+
146+ tester ("ntpath.join('a/b', 'x/y')" , 'a/b\\ x/y' )
147+ tester ("ntpath.join('/a/b', 'x/y')" , '/a/b\\ x/y' )
148+ tester ("ntpath.join('/a/b/', 'x/y')" , '/a/b/x/y' )
149+ tester ("ntpath.join('c:', 'x/y')" , 'c:x/y' )
150+ tester ("ntpath.join('c:a/b', 'x/y')" , 'c:a/b\\ x/y' )
151+ tester ("ntpath.join('c:a/b/', 'x/y')" , 'c:a/b/x/y' )
152+ tester ("ntpath.join('c:/', 'x/y')" , 'c:/x/y' )
153+ tester ("ntpath.join('c:/a/b', 'x/y')" , 'c:/a/b\\ x/y' )
154+ tester ("ntpath.join('c:/a/b/', 'x/y')" , 'c:/a/b/x/y' )
155+ tester ("ntpath.join('//computer/share', 'x/y')" , '//computer/share\\ x/y' )
156+ tester ("ntpath.join('//computer/share/', 'x/y')" , '//computer/share/x/y' )
157+ tester ("ntpath.join('//computer/share/a/b', 'x/y')" , '//computer/share/a/b\\ x/y' )
158+
159+ tester ("ntpath.join('a/b', '/x/y')" , '/x/y' )
160+ tester ("ntpath.join('/a/b', '/x/y')" , '/x/y' )
161+ tester ("ntpath.join('c:', '/x/y')" , 'c:/x/y' )
162+ tester ("ntpath.join('c:a/b', '/x/y')" , 'c:/x/y' )
163+ tester ("ntpath.join('c:/', '/x/y')" , 'c:/x/y' )
164+ tester ("ntpath.join('c:/a/b', '/x/y')" , 'c:/x/y' )
165+ tester ("ntpath.join('//computer/share', '/x/y')" , '//computer/share/x/y' )
166+ tester ("ntpath.join('//computer/share/', '/x/y')" , '//computer/share/x/y' )
167+ tester ("ntpath.join('//computer/share/a', '/x/y')" , '//computer/share/x/y' )
168+
169+ tester ("ntpath.join('c:', 'C:x/y')" , 'C:x/y' )
170+ tester ("ntpath.join('c:a/b', 'C:x/y')" , 'C:a/b\\ x/y' )
171+ tester ("ntpath.join('c:/', 'C:x/y')" , 'C:/x/y' )
172+ tester ("ntpath.join('c:/a/b', 'C:x/y')" , 'C:/a/b\\ x/y' )
173+
174+ for x in ('' , 'a/b' , '/a/b' , 'c:' , 'c:a/b' , 'c:/' , 'c:/a/b' ,
175+ '//computer/share' , '//computer/share/' , '//computer/share/a/b' ):
176+ for y in ('d:' , 'd:x/y' , 'd:/' , 'd:/x/y' ,
177+ '//machine/common' , '//machine/common/' , '//machine/common/x/y' ):
178+ tester ("ntpath.join(%r, %r)" % (x , y ), y )
176179
177180 tester ("ntpath.join('\\ \\ computer\\ share\\ ', 'a', 'b')" , '\\ \\ computer\\ share\\ a\\ b' )
178181 tester ("ntpath.join('\\ \\ computer\\ share', 'a', 'b')" , '\\ \\ computer\\ share\\ a\\ b' )
0 commit comments