@@ -61,22 +61,6 @@ class DummyPurePathTest(unittest.TestCase):
61
61
# Use a base path that's unrelated to any real filesystem path.
62
62
base = f'/this/path/kills/fascists/{ TESTFN } '
63
63
64
- # Keys are canonical paths, values are list of tuples of arguments
65
- # supposed to produce equal paths.
66
- equivalences = {
67
- 'a/b' : [
68
- ('a' , 'b' ), ('a/' , 'b' ), ('a' , 'b/' ), ('a/' , 'b/' ),
69
- ('a/b/' ,), ('a//b' ,), ('a//b//' ,),
70
- # Empty components get removed.
71
- ('' , 'a' , 'b' ), ('a' , '' , 'b' ), ('a' , 'b' , '' ),
72
- ],
73
- '/b/c/d' : [
74
- ('a' , '/b/c' , 'd' ), ('/a' , '/b/c' , 'd' ),
75
- # Empty components get removed.
76
- ('/' , 'b' , '' , 'c/d' ), ('/' , '' , 'b/c/d' ), ('' , '/b/c/d' ),
77
- ],
78
- }
79
-
80
64
def setUp (self ):
81
65
p = self .cls ('a' )
82
66
self .pathmod = p .pathmod
@@ -132,31 +116,6 @@ def with_segments(self, *pathsegments):
132
116
for parent in p .parents :
133
117
self .assertEqual (42 , parent .session_id )
134
118
135
- def _check_parse_path (self , raw_path , * expected ):
136
- sep = self .pathmod .sep
137
- actual = self .cls ._parse_path (raw_path .replace ('/' , sep ))
138
- self .assertEqual (actual , expected )
139
- if altsep := self .pathmod .altsep :
140
- actual = self .cls ._parse_path (raw_path .replace ('/' , altsep ))
141
- self .assertEqual (actual , expected )
142
-
143
- def test_parse_path_common (self ):
144
- check = self ._check_parse_path
145
- sep = self .pathmod .sep
146
- check ('' , '' , '' , [])
147
- check ('a' , '' , '' , ['a' ])
148
- check ('a/' , '' , '' , ['a' ])
149
- check ('a/b' , '' , '' , ['a' , 'b' ])
150
- check ('a/b/' , '' , '' , ['a' , 'b' ])
151
- check ('a/b/c/d' , '' , '' , ['a' , 'b' , 'c' , 'd' ])
152
- check ('a/b//c/d' , '' , '' , ['a' , 'b' , 'c' , 'd' ])
153
- check ('a/b/c/d' , '' , '' , ['a' , 'b' , 'c' , 'd' ])
154
- check ('.' , '' , '' , [])
155
- check ('././b' , '' , '' , ['b' ])
156
- check ('a/./b' , '' , '' , ['a' , 'b' ])
157
- check ('a/./.' , '' , '' , ['a' ])
158
- check ('/a/b' , '' , sep , ['a' , 'b' ])
159
-
160
119
def test_join_common (self ):
161
120
P = self .cls
162
121
p = P ('a/b' )
@@ -202,19 +161,6 @@ def test_as_posix_common(self):
202
161
self .assertEqual (P (pathstr ).as_posix (), pathstr )
203
162
# Other tests for as_posix() are in test_equivalences().
204
163
205
- def test_eq_common (self ):
206
- P = self .cls
207
- self .assertEqual (P ('a/b' ), P ('a/b' ))
208
- self .assertEqual (P ('a/b' ), P ('a' , 'b' ))
209
- self .assertNotEqual (P ('a/b' ), P ('a' ))
210
- self .assertNotEqual (P ('a/b' ), P ('/a/b' ))
211
- self .assertNotEqual (P ('a/b' ), P ())
212
- self .assertNotEqual (P ('/a/b' ), P ('/' ))
213
- self .assertNotEqual (P (), P ('/' ))
214
- self .assertNotEqual (P (), "" )
215
- self .assertNotEqual (P (), {})
216
- self .assertNotEqual (P (), int )
217
-
218
164
def test_match_empty (self ):
219
165
P = self .cls
220
166
self .assertRaises (ValueError , P ('a' ).match , '' )
@@ -299,24 +245,6 @@ def test_parts_common(self):
299
245
parts = p .parts
300
246
self .assertEqual (parts , (sep , 'a' , 'b' ))
301
247
302
- def test_equivalences (self ):
303
- for k , tuples in self .equivalences .items ():
304
- canon = k .replace ('/' , self .sep )
305
- posix = k .replace (self .sep , '/' )
306
- if canon != posix :
307
- tuples = tuples + [
308
- tuple (part .replace ('/' , self .sep ) for part in t )
309
- for t in tuples
310
- ]
311
- tuples .append ((posix , ))
312
- pcanon = self .cls (canon )
313
- for t in tuples :
314
- p = self .cls (* t )
315
- self .assertEqual (p , pcanon , "failed with args {}" .format (t ))
316
- self .assertEqual (hash (p ), hash (pcanon ))
317
- self .assertEqual (str (p ), canon )
318
- self .assertEqual (p .as_posix (), posix )
319
-
320
248
def test_parent_common (self ):
321
249
# Relative
322
250
P = self .cls
@@ -918,11 +846,6 @@ def test_samefile(self):
918
846
self .assertRaises (FileNotFoundError , r .samefile , r )
919
847
self .assertRaises (FileNotFoundError , r .samefile , non_existent )
920
848
921
- def test_empty_path (self ):
922
- # The empty path points to '.'
923
- p = self .cls ('' )
924
- self .assertEqual (str (p ), '.' )
925
-
926
849
def test_exists (self ):
927
850
P = self .cls
928
851
p = P (self .base )
@@ -1598,15 +1521,6 @@ def test_is_char_device_false(self):
1598
1521
self .assertIs ((P / 'fileA\udfff ' ).is_char_device (), False )
1599
1522
self .assertIs ((P / 'fileA\x00 ' ).is_char_device (), False )
1600
1523
1601
- def test_parts_interning (self ):
1602
- P = self .cls
1603
- p = P ('/usr/bin/foo' )
1604
- q = P ('/usr/local/bin' )
1605
- # 'usr'
1606
- self .assertIs (p .parts [1 ], q .parts [1 ])
1607
- # 'bin'
1608
- self .assertIs (p .parts [2 ], q .parts [3 ])
1609
-
1610
1524
def _check_complex_symlinks (self , link0_target ):
1611
1525
if not self .can_symlink :
1612
1526
self .skipTest ("symlinks required" )
0 commit comments