@@ -1628,11 +1628,6 @@ def cleanup():
16281628 # Broken symlink (pointing to itself).
16291629 os .symlink ('brokenLinkLoop' , join ('brokenLinkLoop' ))
16301630
1631- def assertSame (self , path_a , path_b ):
1632- self .assertTrue (os .path .samefile (str (path_a ), str (path_b )),
1633- "%r and %r don't point to the same file" %
1634- (path_a , path_b ))
1635-
16361631 def assertFileNotFound (self , func , * args , ** kwargs ):
16371632 with self .assertRaises (FileNotFoundError ) as cm :
16381633 func (* args , ** kwargs )
@@ -1664,7 +1659,7 @@ def test_samefile(self):
16641659 def test_empty_path (self ):
16651660 # The empty path points to '.'
16661661 p = self .cls ('' )
1667- self .assertEqual (p . stat ( ), os . stat ( '.' ) )
1662+ self .assertEqual (str ( p ), '.' )
16681663
16691664 def test_exists (self ):
16701665 P = self .cls
@@ -1693,9 +1688,6 @@ def test_open_common(self):
16931688 with (p / 'fileA' ).open ('rb' ) as f :
16941689 self .assertIsInstance (f , io .BufferedIOBase )
16951690 self .assertEqual (f .read ().strip (), b"this is file A" )
1696- with (p / 'fileA' ).open ('rb' , buffering = 0 ) as f :
1697- self .assertIsInstance (f , io .RawIOBase )
1698- self .assertEqual (f .read ().strip (), b"this is file A" )
16991691
17001692 def test_read_write_bytes (self ):
17011693 p = self .cls (BASE )
@@ -2017,7 +2009,6 @@ def test_glob_permissions(self):
20172009 P = self .cls
20182010 base = P (BASE ) / 'permissions'
20192011 base .mkdir ()
2020- self .addCleanup (os_helper .rmtree , base )
20212012
20222013 for i in range (100 ):
20232014 link = base / f"link{ i } "
@@ -2045,8 +2036,8 @@ def test_glob_above_recursion_limit(self):
20452036 recursion_limit = 50
20462037 # directory_depth > recursion_limit
20472038 directory_depth = recursion_limit + 10
2048- base = pathlib . Path ( os_helper . TESTFN , 'deep' )
2049- path = pathlib . Path (base , * (['d' ] * directory_depth ))
2039+ base = self . cls ( BASE , 'deep' )
2040+ path = self . cls (base , * (['d' ] * directory_depth ))
20502041 path .mkdir (parents = True )
20512042
20522043 with set_recursion_limit (recursion_limit ):
@@ -2242,18 +2233,12 @@ def test_is_file_no_follow_symlinks(self):
22422233
22432234 def test_is_mount (self ):
22442235 P = self .cls (BASE )
2245- if os .name == 'nt' :
2246- R = self .cls ('c:\\ ' )
2247- else :
2248- R = self .cls ('/' )
22492236 self .assertFalse ((P / 'fileA' ).is_mount ())
22502237 self .assertFalse ((P / 'dirA' ).is_mount ())
22512238 self .assertFalse ((P / 'non-existing' ).is_mount ())
22522239 self .assertFalse ((P / 'fileA' / 'bah' ).is_mount ())
2253- self .assertTrue (R .is_mount ())
22542240 if self .can_symlink :
22552241 self .assertFalse ((P / 'linkA' ).is_mount ())
2256- self .assertIs ((R / '\udfff ' ).is_mount (), False )
22572242
22582243 def test_is_symlink (self ):
22592244 P = self .cls (BASE )
@@ -2496,6 +2481,12 @@ def with_segments(self, *pathsegments):
24962481 for dirpath , dirnames , filenames in p .walk ():
24972482 self .assertEqual (42 , dirpath .session_id )
24982483
2484+ def test_open_unbuffered (self ):
2485+ p = self .cls (BASE )
2486+ with (p / 'fileA' ).open ('rb' , buffering = 0 ) as f :
2487+ self .assertIsInstance (f , io .RawIOBase )
2488+ self .assertEqual (f .read ().strip (), b"this is file A" )
2489+
24992490 def test_resolve_nonexist_relative_issue38671 (self ):
25002491 p = self .cls ('non' , 'exist' )
25012492
@@ -2896,6 +2887,14 @@ def test_is_char_device_true(self):
28962887 self .assertIs (self .cls ('/dev/null\udfff ' ).is_char_device (), False )
28972888 self .assertIs (self .cls ('/dev/null\x00 ' ).is_char_device (), False )
28982889
2890+ def test_is_mount_root (self ):
2891+ if os .name == 'nt' :
2892+ R = self .cls ('c:\\ ' )
2893+ else :
2894+ R = self .cls ('/' )
2895+ self .assertTrue (R .is_mount ())
2896+ self .assertFalse ((R / '\udfff ' ).is_mount ())
2897+
28992898 def test_passing_kwargs_deprecated (self ):
29002899 with self .assertWarns (DeprecationWarning ):
29012900 self .cls (foo = "bar" )
0 commit comments