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
@@ -1784,6 +1784,7 @@ def test_reset_tzpath_relative_paths(self):
17841784 ("/usr/share/zoneinfo" , "../relative/path" ,),
17851785 ("path/to/somewhere" , "../relative/path" ,),
17861786 ("/usr/share/zoneinfo" , "path/to/somewhere" , "../relative/path" ,),
1787+ (FakePath ("path/to/somewhere" ),)
17871788 ]
17881789 for input_paths in bad_values :
17891790 with self .subTest (input_paths = input_paths ):
@@ -1795,6 +1796,9 @@ def test_tzpath_type_error(self):
17951796 "/etc/zoneinfo:/usr/share/zoneinfo" ,
17961797 b"/etc/zoneinfo:/usr/share/zoneinfo" ,
17971798 0 ,
1799+ (b"/bytes/path" , "/valid/path" ),
1800+ (FakePath (b"/bytes/path" ),),
1801+ (0 ,),
17981802 ]
17991803
18001804 for bad_value in bad_values :
@@ -1805,15 +1809,20 @@ def test_tzpath_type_error(self):
18051809 def test_tzpath_attribute (self ):
18061810 tzpath_0 = [f"{ DRIVE } /one" , f"{ DRIVE } /two" ]
18071811 tzpath_1 = [f"{ DRIVE } /three" ]
1812+ tzpath_pathlike = (FakePath (f"{ DRIVE } /usr/share/zoneinfo" ),)
18081813
18091814 with self .tzpath_context (tzpath_0 ):
18101815 query_0 = self .module .TZPATH
18111816
18121817 with self .tzpath_context (tzpath_1 ):
18131818 query_1 = self .module .TZPATH
18141819
1820+ with self .tzpath_context (tzpath_pathlike ):
1821+ query_pathlike = self .module .TZPATH
1822+
18151823 self .assertSequenceEqual (tzpath_0 , query_0 )
18161824 self .assertSequenceEqual (tzpath_1 , query_1 )
1825+ self .assertSequenceEqual (tuple ([os .fspath (p ) for p in tzpath_pathlike ]), query_pathlike )
18171826
18181827
18191828class CTzPathTest (TzPathTest ):
0 commit comments