@@ -1391,17 +1391,17 @@ def test_copy_file(self):
1391
1391
target = base / 'copyA'
1392
1392
result = source .copy (target )
1393
1393
self .assertEqual (result , target )
1394
- self .assertTrue (target .exists ())
1395
- self .assertEqual (source .read_text (), target .read_text ())
1394
+ self .assertTrue (result . info .exists ())
1395
+ self .assertEqual (source .read_text (), result .read_text ())
1396
1396
1397
1397
def test_copy_file_to_existing_file (self ):
1398
1398
base = self .cls (self .base )
1399
1399
source = base / 'fileA'
1400
1400
target = base / 'dirB' / 'fileB'
1401
1401
result = source .copy (target )
1402
1402
self .assertEqual (result , target )
1403
- self .assertTrue (target .exists ())
1404
- self .assertEqual (source .read_text (), target .read_text ())
1403
+ self .assertTrue (result . info .exists ())
1404
+ self .assertEqual (source .read_text (), result .read_text ())
1405
1405
1406
1406
def test_copy_file_to_existing_directory (self ):
1407
1407
base = self .cls (self .base )
@@ -1416,8 +1416,8 @@ def test_copy_file_empty(self):
1416
1416
source .write_bytes (b'' )
1417
1417
result = source .copy (target )
1418
1418
self .assertEqual (result , target )
1419
- self .assertTrue (target .exists ())
1420
- self .assertEqual (target .read_bytes (), b'' )
1419
+ self .assertTrue (result . info .exists ())
1420
+ self .assertEqual (result .read_bytes (), b'' )
1421
1421
1422
1422
def test_copy_file_to_itself (self ):
1423
1423
base = self .cls (self .base )
@@ -1432,13 +1432,13 @@ def test_copy_dir_simple(self):
1432
1432
target = base / 'copyC'
1433
1433
result = source .copy (target )
1434
1434
self .assertEqual (result , target )
1435
- self .assertTrue (target .is_dir ())
1436
- self .assertTrue (target .joinpath ('dirD' ).is_dir ())
1437
- self .assertTrue (target .joinpath ('dirD' , 'fileD' ).is_file ())
1438
- self .assertEqual (target .joinpath ('dirD' , 'fileD' ).read_text (),
1435
+ self .assertTrue (result . info .is_dir ())
1436
+ self .assertTrue (result .joinpath ('dirD' ). info .is_dir ())
1437
+ self .assertTrue (result .joinpath ('dirD' , 'fileD' ). info .is_file ())
1438
+ self .assertEqual (result .joinpath ('dirD' , 'fileD' ).read_text (),
1439
1439
"this is file D\n " )
1440
- self .assertTrue (target .joinpath ('fileC' ).is_file ())
1441
- self .assertTrue (target .joinpath ('fileC' ).read_text (),
1440
+ self .assertTrue (result .joinpath ('fileC' ). info .is_file ())
1441
+ self .assertTrue (result .joinpath ('fileC' ).read_text (),
1442
1442
"this is file C\n " )
1443
1443
1444
1444
def test_copy_dir_complex (self , follow_symlinks = True ):
@@ -1462,7 +1462,7 @@ def ordered_walk(path):
1462
1462
1463
1463
# Compare the source and target trees
1464
1464
source_walk = ordered_walk (source )
1465
- target_walk = ordered_walk (target )
1465
+ target_walk = ordered_walk (result )
1466
1466
for source_item , target_item in zip (source_walk , target_walk , strict = True ):
1467
1467
self .assertEqual (source_item [0 ].parts [len (source .parts ):],
1468
1468
target_item [0 ].parts [len (target .parts ):]) # dirpath
@@ -1472,12 +1472,12 @@ def ordered_walk(path):
1472
1472
for filename in source_item [2 ]:
1473
1473
source_file = source_item [0 ].joinpath (filename )
1474
1474
target_file = target_item [0 ].joinpath (filename )
1475
- if follow_symlinks or not source_file .is_symlink ():
1475
+ if follow_symlinks or not source_file .info . is_symlink ():
1476
1476
# Regular file.
1477
1477
self .assertEqual (source_file .read_bytes (), target_file .read_bytes ())
1478
- elif source_file .is_dir ():
1478
+ elif source_file .info . is_dir ():
1479
1479
# Symlink to directory.
1480
- self .assertTrue (target_file .is_dir ())
1480
+ self .assertTrue (target_file .info . is_dir ())
1481
1481
self .assertEqual (source_file .readlink (), target_file .readlink ())
1482
1482
else :
1483
1483
# Symlink to file.
@@ -1503,13 +1503,13 @@ def test_copy_dir_to_existing_directory_dirs_exist_ok(self):
1503
1503
target .joinpath ('dirD' ).mkdir ()
1504
1504
result = source .copy (target , dirs_exist_ok = True )
1505
1505
self .assertEqual (result , target )
1506
- self .assertTrue (target .is_dir ())
1507
- self .assertTrue (target .joinpath ('dirD' ).is_dir ())
1508
- self .assertTrue (target .joinpath ('dirD' , 'fileD' ).is_file ())
1509
- self .assertEqual (target .joinpath ('dirD' , 'fileD' ).read_text (),
1506
+ self .assertTrue (result . info .is_dir ())
1507
+ self .assertTrue (result .joinpath ('dirD' ). info .is_dir ())
1508
+ self .assertTrue (result .joinpath ('dirD' , 'fileD' ). info .is_file ())
1509
+ self .assertEqual (result .joinpath ('dirD' , 'fileD' ).read_text (),
1510
1510
"this is file D\n " )
1511
- self .assertTrue (target .joinpath ('fileC' ).is_file ())
1512
- self .assertTrue (target .joinpath ('fileC' ).read_text (),
1511
+ self .assertTrue (result .joinpath ('fileC' ). info .is_file ())
1512
+ self .assertTrue (result .joinpath ('fileC' ).read_text (),
1513
1513
"this is file C\n " )
1514
1514
1515
1515
def test_copy_dir_to_itself (self ):
@@ -1524,15 +1524,15 @@ def test_copy_dir_into_itself(self):
1524
1524
target = base / 'dirC' / 'dirD' / 'copyC'
1525
1525
self .assertRaises (OSError , source .copy , target )
1526
1526
self .assertRaises (OSError , source .copy , target , follow_symlinks = False )
1527
- self .assertFalse (target .exists ())
1527
+ self .assertFalse (target .info . exists ())
1528
1528
1529
1529
def test_copy_into (self ):
1530
1530
base = self .cls (self .base )
1531
1531
source = base / 'fileA'
1532
1532
target_dir = base / 'dirA'
1533
1533
result = source .copy_into (target_dir )
1534
1534
self .assertEqual (result , target_dir / 'fileA' )
1535
- self .assertTrue (result .exists ())
1535
+ self .assertTrue (result .info . exists ())
1536
1536
self .assertEqual (source .read_text (), result .read_text ())
1537
1537
1538
1538
def test_copy_into_empty_name (self ):
0 commit comments