@@ -1183,21 +1183,13 @@ def test_relative_to(self):
1183
1183
self .assertRaises (ValueError , p .relative_to , P ('/Foo' ), walk_up = True )
1184
1184
self .assertRaises (ValueError , p .relative_to , P ('C:/Foo' ), walk_up = True )
1185
1185
p = P ('C:/Foo/Bar' )
1186
- self .assertEqual (p .relative_to (P ('c:' )), P ('/Foo/Bar' ))
1187
- self .assertEqual (p .relative_to ('c:' ), P ('/Foo/Bar' ))
1188
- self .assertEqual (str (p .relative_to (P ('c:' ))), '\\ Foo\\ Bar' )
1189
- self .assertEqual (str (p .relative_to ('c:' )), '\\ Foo\\ Bar' )
1190
1186
self .assertEqual (p .relative_to (P ('c:/' )), P ('Foo/Bar' ))
1191
1187
self .assertEqual (p .relative_to ('c:/' ), P ('Foo/Bar' ))
1192
1188
self .assertEqual (p .relative_to (P ('c:/foO' )), P ('Bar' ))
1193
1189
self .assertEqual (p .relative_to ('c:/foO' ), P ('Bar' ))
1194
1190
self .assertEqual (p .relative_to ('c:/foO/' ), P ('Bar' ))
1195
1191
self .assertEqual (p .relative_to (P ('c:/foO/baR' )), P ())
1196
1192
self .assertEqual (p .relative_to ('c:/foO/baR' ), P ())
1197
- self .assertEqual (p .relative_to (P ('c:' ), walk_up = True ), P ('/Foo/Bar' ))
1198
- self .assertEqual (p .relative_to ('c:' , walk_up = True ), P ('/Foo/Bar' ))
1199
- self .assertEqual (str (p .relative_to (P ('c:' ), walk_up = True )), '\\ Foo\\ Bar' )
1200
- self .assertEqual (str (p .relative_to ('c:' , walk_up = True )), '\\ Foo\\ Bar' )
1201
1193
self .assertEqual (p .relative_to (P ('c:/' ), walk_up = True ), P ('Foo/Bar' ))
1202
1194
self .assertEqual (p .relative_to ('c:/' , walk_up = True ), P ('Foo/Bar' ))
1203
1195
self .assertEqual (p .relative_to (P ('c:/foO' ), walk_up = True ), P ('Bar' ))
@@ -1209,6 +1201,8 @@ def test_relative_to(self):
1209
1201
self .assertEqual (p .relative_to ('C:/Foo/Bar/Baz' , walk_up = True ), P ('..' ))
1210
1202
self .assertEqual (p .relative_to ('C:/Foo/Baz' , walk_up = True ), P ('../Bar' ))
1211
1203
# Unrelated paths.
1204
+ self .assertRaises (ValueError , p .relative_to , 'c:' )
1205
+ self .assertRaises (ValueError , p .relative_to , P ('c:' ))
1212
1206
self .assertRaises (ValueError , p .relative_to , P ('C:/Baz' ))
1213
1207
self .assertRaises (ValueError , p .relative_to , P ('C:/Foo/Bar/Baz' ))
1214
1208
self .assertRaises (ValueError , p .relative_to , P ('C:/Foo/Baz' ))
@@ -1218,6 +1212,8 @@ def test_relative_to(self):
1218
1212
self .assertRaises (ValueError , p .relative_to , P ('/' ))
1219
1213
self .assertRaises (ValueError , p .relative_to , P ('/Foo' ))
1220
1214
self .assertRaises (ValueError , p .relative_to , P ('//C/Foo' ))
1215
+ self .assertRaises (ValueError , p .relative_to , 'c:' , walk_up = True )
1216
+ self .assertRaises (ValueError , p .relative_to , P ('c:' ), walk_up = True )
1221
1217
self .assertRaises (ValueError , p .relative_to , P ('C:Foo' ), walk_up = True )
1222
1218
self .assertRaises (ValueError , p .relative_to , P ('d:' ), walk_up = True )
1223
1219
self .assertRaises (ValueError , p .relative_to , P ('d:/' ), walk_up = True )
@@ -1275,13 +1271,13 @@ def test_is_relative_to(self):
1275
1271
self .assertFalse (p .is_relative_to (P ('C:Foo/Bar/Baz' )))
1276
1272
self .assertFalse (p .is_relative_to (P ('C:Foo/Baz' )))
1277
1273
p = P ('C:/Foo/Bar' )
1278
- self .assertTrue (p .is_relative_to ('c:' ))
1279
1274
self .assertTrue (p .is_relative_to (P ('c:/' )))
1280
1275
self .assertTrue (p .is_relative_to (P ('c:/foO' )))
1281
1276
self .assertTrue (p .is_relative_to ('c:/foO/' ))
1282
1277
self .assertTrue (p .is_relative_to (P ('c:/foO/baR' )))
1283
1278
self .assertTrue (p .is_relative_to ('c:/foO/baR' ))
1284
1279
# Unrelated paths.
1280
+ self .assertFalse (p .is_relative_to ('c:' ))
1285
1281
self .assertFalse (p .is_relative_to (P ('C:/Baz' )))
1286
1282
self .assertFalse (p .is_relative_to (P ('C:/Foo/Bar/Baz' )))
1287
1283
self .assertFalse (p .is_relative_to (P ('C:/Foo/Baz' )))
0 commit comments