@@ -300,10 +300,10 @@ def test_removedirs_p(self, tmpdir):
300300 (dir / 'file' ).touch ()
301301 (dir / 'sub' ).mkdir ()
302302 dir .removedirs_p ()
303- assert dir .isdir ()
304- assert (dir / 'file' ).isfile ()
303+ assert dir .is_dir ()
304+ assert (dir / 'file' ).is_file ()
305305 # TODO: shouldn't sub get removed?
306- # assert not (dir / 'sub').isdir ()
306+ # assert not (dir / 'sub').is_dir ()
307307
308308
309309class TestReadWriteText :
@@ -360,7 +360,7 @@ def test_symlink_none(self, tmpdir):
360360 with root :
361361 file = (Path ('dir' ).mkdir () / 'file' ).touch ()
362362 file .symlink ()
363- assert Path ('file' ).isfile ()
363+ assert Path ('file' ).is_file ()
364364
365365 def test_readlinkabs_passthrough (self , tmpdir ):
366366 link = Path (tmpdir ) / 'link'
@@ -383,7 +383,7 @@ def test_skip_symlinks(self, tmpdir):
383383 assert len (list (root .walk ())) == 4
384384
385385 skip_links = path .Traversal (
386- lambda item : item .isdir () and not item .islink (),
386+ lambda item : item .is_dir () and not item .islink (),
387387 )
388388 assert len (list (skip_links (root .walk ()))) == 3
389389
@@ -474,7 +474,7 @@ def test_touch(self, tmpdir):
474474 t1 = time .time () + threshold
475475
476476 assert f .exists ()
477- assert f .isfile ()
477+ assert f .is_file ()
478478 assert f .size == 0
479479 assert t0 <= f .mtime <= t1
480480 if hasattr (os .path , 'getctime' ):
@@ -493,7 +493,7 @@ def test_touch(self, tmpdir):
493493 assert t0 <= t1 < t2 <= t3 # sanity check
494494
495495 assert f .exists ()
496- assert f .isfile ()
496+ assert f .is_file ()
497497 assert f .size == 10
498498 assert t2 <= f .mtime <= t3
499499 if hasattr (os .path , 'getctime' ):
@@ -593,7 +593,7 @@ def test_makedirs(self, tmpdir):
593593 boz = foo / 'bar' / 'baz' / 'boz'
594594 boz .makedirs ()
595595 try :
596- assert boz .isdir ()
596+ assert boz .is_dir ()
597597 finally :
598598 boz .removedirs ()
599599 assert not foo .exists ()
@@ -602,7 +602,7 @@ def test_makedirs(self, tmpdir):
602602 foo .mkdir (0o750 )
603603 boz .makedirs (0o700 )
604604 try :
605- assert boz .isdir ()
605+ assert boz .is_dir ()
606606 finally :
607607 boz .removedirs ()
608608 assert not foo .exists ()
@@ -648,21 +648,21 @@ def test_shutil(self, tmpdir):
648648
649649 # Test simple file copying.
650650 testFile .copyfile (testCopy )
651- assert testCopy .isfile ()
651+ assert testCopy .is_file ()
652652 assert testFile .bytes () == testCopy .bytes ()
653653
654654 # Test copying into a directory.
655655 testCopy2 = testA / testFile .name
656656 testFile .copy (testA )
657- assert testCopy2 .isfile ()
657+ assert testCopy2 .is_file ()
658658 assert testFile .bytes () == testCopy2 .bytes ()
659659
660660 # Make a link for the next test to use.
661661 testFile .symlink (testLink )
662662
663663 # Test copying directory tree.
664664 testA .copytree (testC )
665- assert testC .isdir ()
665+ assert testC .is_dir ()
666666 self .assertSetsEqual (
667667 testC .iterdir (),
668668 [testC / testCopy .name , testC / testFile .name , testCopyOfLink ],
@@ -675,7 +675,7 @@ def test_shutil(self, tmpdir):
675675
676676 # Copy again, preserving symlinks.
677677 testA .copytree (testC , True )
678- assert testC .isdir ()
678+ assert testC .is_dir ()
679679 self .assertSetsEqual (
680680 testC .iterdir (),
681681 [testC / testCopy .name , testC / testFile .name , testCopyOfLink ],
@@ -698,7 +698,7 @@ def test_patterns(self, tmpdir):
698698 dirs = [d , d / 'xdir' , d / 'xdir.tmp' , d / 'xdir.tmp' / 'xsubdir' ]
699699
700700 for e in dirs :
701- if not e .isdir ():
701+ if not e .is_dir ():
702702 e .makedirs ()
703703
704704 for name in names :
@@ -913,12 +913,12 @@ def testing_structure(self, tmpdir):
913913
914914 def check_link (self ):
915915 target = Path (self .subdir_b / self .test_link .name )
916- check = target .islink if hasattr (os , 'symlink' ) else target .isfile
916+ check = target .islink if hasattr (os , 'symlink' ) else target .is_file
917917 assert check ()
918918
919919 def test_with_nonexisting_dst_kwargs (self ):
920920 self .subdir_a .merge_tree (self .subdir_b , symlinks = True )
921- assert self .subdir_b .isdir ()
921+ assert self .subdir_b .is_dir ()
922922 expected = {
923923 self .subdir_b / self .test_file .name ,
924924 self .subdir_b / self .test_link .name ,
@@ -928,7 +928,7 @@ def test_with_nonexisting_dst_kwargs(self):
928928
929929 def test_with_nonexisting_dst_args (self ):
930930 self .subdir_a .merge_tree (self .subdir_b , True )
931- assert self .subdir_b .isdir ()
931+ assert self .subdir_b .is_dir ()
932932 expected = {
933933 self .subdir_b / self .test_file .name ,
934934 self .subdir_b / self .test_link .name ,
@@ -948,7 +948,7 @@ def test_with_existing_dst(self):
948948
949949 self .subdir_a .merge_tree (self .subdir_b , True )
950950
951- assert self .subdir_b .isdir ()
951+ assert self .subdir_b .is_dir ()
952952 expected = {
953953 self .subdir_b / self .test_file .name ,
954954 self .subdir_b / self .test_link .name ,
@@ -965,7 +965,7 @@ def test_copytree_parameters(self):
965965 ignore = shutil .ignore_patterns ('testlink*' )
966966 self .subdir_a .merge_tree (self .subdir_b , ignore = ignore )
967967
968- assert self .subdir_b .isdir ()
968+ assert self .subdir_b .is_dir ()
969969 assert list (self .subdir_b .iterdir ()) == [self .subdir_b / self .test_file .name ]
970970
971971 def test_only_newer (self ):
@@ -984,7 +984,7 @@ def test_only_newer(self):
984984 def test_nested (self ):
985985 self .subdir_a .joinpath ('subsub' ).mkdir ()
986986 self .subdir_a .merge_tree (self .subdir_b )
987- assert self .subdir_b .joinpath ('subsub' ).isdir ()
987+ assert self .subdir_b .joinpath ('subsub' ).is_dir ()
988988
989989 def test_listdir (self ):
990990 with pytest .deprecated_call ():
@@ -1040,7 +1040,7 @@ def test_constructor(self):
10401040 d = TempDir ()
10411041 assert isinstance (d , path .Path )
10421042 assert d .exists ()
1043- assert d .isdir ()
1043+ assert d .is_dir ()
10441044 d .rmdir ()
10451045 assert not d .exists ()
10461046
@@ -1074,8 +1074,8 @@ def test_context_manager_using_with(self):
10741074 """
10751075
10761076 with TempDir () as d :
1077- assert d .isdir ()
1078- assert not d .isdir ()
1077+ assert d .is_dir ()
1078+ assert not d .is_dir ()
10791079
10801080 def test_cleaned_up_on_interrupt (self ):
10811081 with contextlib .suppress (KeyboardInterrupt ):
0 commit comments