@@ -1007,25 +1007,6 @@ def test_is_readable(self):
10071007 p = self .cls (self .base )
10081008 self .assertIsInstance (p , ReadablePath )
10091009
1010- def test_exists (self ):
1011- P = self .cls
1012- p = P (self .base )
1013- self .assertIs (True , p .exists ())
1014- self .assertIs (True , (p / 'dirA' ).exists ())
1015- self .assertIs (True , (p / 'fileA' ).exists ())
1016- self .assertIs (False , (p / 'fileA' / 'bah' ).exists ())
1017- if self .can_symlink :
1018- self .assertIs (True , (p / 'linkA' ).exists ())
1019- self .assertIs (True , (p / 'linkB' ).exists ())
1020- self .assertIs (True , (p / 'linkB' / 'fileB' ).exists ())
1021- self .assertIs (False , (p / 'linkA' / 'bah' ).exists ())
1022- self .assertIs (False , (p / 'brokenLink' ).exists ())
1023- self .assertIs (True , (p / 'brokenLink' ).exists (follow_symlinks = False ))
1024- self .assertIs (False , (p / 'foo' ).exists ())
1025- self .assertIs (False , P ('/xyzzy' ).exists ())
1026- self .assertIs (False , P (self .base + '\udfff ' ).exists ())
1027- self .assertIs (False , P (self .base + '\x00 ' ).exists ())
1028-
10291010 def test_magic_open (self ):
10301011 p = self .cls (self .base )
10311012 with magic_open (p / 'fileA' , 'r' ) as f :
@@ -1058,17 +1039,8 @@ def test_iterdir_nodir(self):
10581039 def test_iterdir_info (self ):
10591040 p = self .cls (self .base )
10601041 for child in p .iterdir ():
1061- info = child .info
1062- self .assertIsInstance (info , PathInfo )
1063- self .assertEqual (info .exists (), child .exists ())
1064- self .assertEqual (info .is_dir (), child .is_dir ())
1065- self .assertEqual (info .is_file (), child .is_file ())
1066- self .assertEqual (info .is_symlink (), child .is_symlink ())
1067- self .assertTrue (info .exists (follow_symlinks = False ))
1068- self .assertEqual (info .is_dir (follow_symlinks = False ),
1069- child .is_dir (follow_symlinks = False ))
1070- self .assertEqual (info .is_file (follow_symlinks = False ),
1071- child .is_file (follow_symlinks = False ))
1042+ self .assertIsInstance (child .info , PathInfo )
1043+ self .assertTrue (child .info .exists (follow_symlinks = False ))
10721044
10731045 def test_glob_common (self ):
10741046 def _check (glob , expected ):
@@ -1248,74 +1220,6 @@ def test_info_is_symlink(self):
12481220 self .assertFalse ((p / 'fileA\udfff ' ).info .is_symlink ())
12491221 self .assertFalse ((p / 'fileA\x00 ' ).info .is_symlink ())
12501222
1251- def test_is_dir (self ):
1252- P = self .cls (self .base )
1253- self .assertTrue ((P / 'dirA' ).is_dir ())
1254- self .assertFalse ((P / 'fileA' ).is_dir ())
1255- self .assertFalse ((P / 'non-existing' ).is_dir ())
1256- self .assertFalse ((P / 'fileA' / 'bah' ).is_dir ())
1257- if self .can_symlink :
1258- self .assertFalse ((P / 'linkA' ).is_dir ())
1259- self .assertTrue ((P / 'linkB' ).is_dir ())
1260- self .assertFalse ((P / 'brokenLink' ).is_dir ())
1261- self .assertFalse ((P / 'dirA\udfff ' ).is_dir ())
1262- self .assertFalse ((P / 'dirA\x00 ' ).is_dir ())
1263-
1264- def test_is_dir_no_follow_symlinks (self ):
1265- P = self .cls (self .base )
1266- self .assertTrue ((P / 'dirA' ).is_dir (follow_symlinks = False ))
1267- self .assertFalse ((P / 'fileA' ).is_dir (follow_symlinks = False ))
1268- self .assertFalse ((P / 'non-existing' ).is_dir (follow_symlinks = False ))
1269- self .assertFalse ((P / 'fileA' / 'bah' ).is_dir (follow_symlinks = False ))
1270- if self .can_symlink :
1271- self .assertFalse ((P / 'linkA' ).is_dir (follow_symlinks = False ))
1272- self .assertFalse ((P / 'linkB' ).is_dir (follow_symlinks = False ))
1273- self .assertFalse ((P / 'brokenLink' ).is_dir (follow_symlinks = False ))
1274- self .assertFalse ((P / 'dirA\udfff ' ).is_dir (follow_symlinks = False ))
1275- self .assertFalse ((P / 'dirA\x00 ' ).is_dir (follow_symlinks = False ))
1276-
1277- def test_is_file (self ):
1278- P = self .cls (self .base )
1279- self .assertTrue ((P / 'fileA' ).is_file ())
1280- self .assertFalse ((P / 'dirA' ).is_file ())
1281- self .assertFalse ((P / 'non-existing' ).is_file ())
1282- self .assertFalse ((P / 'fileA' / 'bah' ).is_file ())
1283- if self .can_symlink :
1284- self .assertTrue ((P / 'linkA' ).is_file ())
1285- self .assertFalse ((P / 'linkB' ).is_file ())
1286- self .assertFalse ((P / 'brokenLink' ).is_file ())
1287- self .assertFalse ((P / 'fileA\udfff ' ).is_file ())
1288- self .assertFalse ((P / 'fileA\x00 ' ).is_file ())
1289-
1290- def test_is_file_no_follow_symlinks (self ):
1291- P = self .cls (self .base )
1292- self .assertTrue ((P / 'fileA' ).is_file (follow_symlinks = False ))
1293- self .assertFalse ((P / 'dirA' ).is_file (follow_symlinks = False ))
1294- self .assertFalse ((P / 'non-existing' ).is_file (follow_symlinks = False ))
1295- self .assertFalse ((P / 'fileA' / 'bah' ).is_file (follow_symlinks = False ))
1296- if self .can_symlink :
1297- self .assertFalse ((P / 'linkA' ).is_file (follow_symlinks = False ))
1298- self .assertFalse ((P / 'linkB' ).is_file (follow_symlinks = False ))
1299- self .assertFalse ((P / 'brokenLink' ).is_file (follow_symlinks = False ))
1300- self .assertFalse ((P / 'fileA\udfff ' ).is_file (follow_symlinks = False ))
1301- self .assertFalse ((P / 'fileA\x00 ' ).is_file (follow_symlinks = False ))
1302-
1303- def test_is_symlink (self ):
1304- P = self .cls (self .base )
1305- self .assertFalse ((P / 'fileA' ).is_symlink ())
1306- self .assertFalse ((P / 'dirA' ).is_symlink ())
1307- self .assertFalse ((P / 'non-existing' ).is_symlink ())
1308- self .assertFalse ((P / 'fileA' / 'bah' ).is_symlink ())
1309- if self .can_symlink :
1310- self .assertTrue ((P / 'linkA' ).is_symlink ())
1311- self .assertTrue ((P / 'linkB' ).is_symlink ())
1312- self .assertTrue ((P / 'brokenLink' ).is_symlink ())
1313- self .assertIs ((P / 'fileA\udfff ' ).is_file (), False )
1314- self .assertIs ((P / 'fileA\x00 ' ).is_file (), False )
1315- if self .can_symlink :
1316- self .assertIs ((P / 'linkA\udfff ' ).is_file (), False )
1317- self .assertIs ((P / 'linkA\x00 ' ).is_file (), False )
1318-
13191223
13201224class WritablePathTest (JoinablePathTest ):
13211225 cls = DummyWritablePath
0 commit comments