1818from functools import cached_property
1919
2020from test .support import MISSING_C_DOCSTRINGS
21- from test .support .os_helper import EnvironmentVarGuard
21+ from test .support .os_helper import EnvironmentVarGuard , FakePath
2222from test .test_zoneinfo import _support as test_support
2323from test .test_zoneinfo ._support import TZPATH_TEST_LOCK , ZoneInfoTestBase
2424from test .support .import_helper import import_module , CleanImport
@@ -1783,6 +1783,7 @@ def test_reset_tzpath_relative_paths(self):
17831783 ("/usr/share/zoneinfo" , "../relative/path" ,),
17841784 ("path/to/somewhere" , "../relative/path" ,),
17851785 ("/usr/share/zoneinfo" , "path/to/somewhere" , "../relative/path" ,),
1786+ (FakePath ("path/to/somewhere" ),)
17861787 ]
17871788 for input_paths in bad_values :
17881789 with self .subTest (input_paths = input_paths ):
@@ -1794,6 +1795,9 @@ def test_tzpath_type_error(self):
17941795 "/etc/zoneinfo:/usr/share/zoneinfo" ,
17951796 b"/etc/zoneinfo:/usr/share/zoneinfo" ,
17961797 0 ,
1798+ (b"/bytes/path" , "/valid/path" ),
1799+ (FakePath (b"/bytes/path" ),),
1800+ (0 ,),
17971801 ]
17981802
17991803 for bad_value in bad_values :
@@ -1804,15 +1808,20 @@ def test_tzpath_type_error(self):
18041808 def test_tzpath_attribute (self ):
18051809 tzpath_0 = [f"{ DRIVE } /one" , f"{ DRIVE } /two" ]
18061810 tzpath_1 = [f"{ DRIVE } /three" ]
1811+ tzpath_pathlike = (FakePath (f"{ DRIVE } /usr/share/zoneinfo" ),)
18071812
18081813 with self .tzpath_context (tzpath_0 ):
18091814 query_0 = self .module .TZPATH
18101815
18111816 with self .tzpath_context (tzpath_1 ):
18121817 query_1 = self .module .TZPATH
18131818
1819+ with self .tzpath_context (tzpath_pathlike ):
1820+ query_pathlike = self .module .TZPATH
1821+
18141822 self .assertSequenceEqual (tzpath_0 , query_0 )
18151823 self .assertSequenceEqual (tzpath_1 , query_1 )
1824+ self .assertSequenceEqual (tuple ([os .fspath (p ) for p in tzpath_pathlike ]), query_pathlike )
18161825
18171826
18181827class CTzPathTest (TzPathTest ):
0 commit comments