18
18
from functools import cached_property
19
19
20
20
from test .support import MISSING_C_DOCSTRINGS
21
- from test .support .os_helper import EnvironmentVarGuard
21
+ from test .support .os_helper import EnvironmentVarGuard , FakePath
22
22
from test .test_zoneinfo import _support as test_support
23
23
from test .test_zoneinfo ._support import TZPATH_TEST_LOCK , ZoneInfoTestBase
24
24
from test .support .import_helper import import_module , CleanImport
@@ -1784,6 +1784,7 @@ def test_reset_tzpath_relative_paths(self):
1784
1784
("/usr/share/zoneinfo" , "../relative/path" ,),
1785
1785
("path/to/somewhere" , "../relative/path" ,),
1786
1786
("/usr/share/zoneinfo" , "path/to/somewhere" , "../relative/path" ,),
1787
+ (FakePath ("path/to/somewhere" ),)
1787
1788
]
1788
1789
for input_paths in bad_values :
1789
1790
with self .subTest (input_paths = input_paths ):
@@ -1795,6 +1796,9 @@ def test_tzpath_type_error(self):
1795
1796
"/etc/zoneinfo:/usr/share/zoneinfo" ,
1796
1797
b"/etc/zoneinfo:/usr/share/zoneinfo" ,
1797
1798
0 ,
1799
+ (b"/bytes/path" , "/valid/path" ),
1800
+ (FakePath (b"/bytes/path" ),),
1801
+ (0 ,),
1798
1802
]
1799
1803
1800
1804
for bad_value in bad_values :
@@ -1805,15 +1809,20 @@ def test_tzpath_type_error(self):
1805
1809
def test_tzpath_attribute (self ):
1806
1810
tzpath_0 = [f"{ DRIVE } /one" , f"{ DRIVE } /two" ]
1807
1811
tzpath_1 = [f"{ DRIVE } /three" ]
1812
+ tzpath_pathlike = (FakePath (f"{ DRIVE } /usr/share/zoneinfo" ),)
1808
1813
1809
1814
with self .tzpath_context (tzpath_0 ):
1810
1815
query_0 = self .module .TZPATH
1811
1816
1812
1817
with self .tzpath_context (tzpath_1 ):
1813
1818
query_1 = self .module .TZPATH
1814
1819
1820
+ with self .tzpath_context (tzpath_pathlike ):
1821
+ query_pathlike = self .module .TZPATH
1822
+
1815
1823
self .assertSequenceEqual (tzpath_0 , query_0 )
1816
1824
self .assertSequenceEqual (tzpath_1 , query_1 )
1825
+ self .assertSequenceEqual (tuple ([os .fspath (p ) for p in tzpath_pathlike ]), query_pathlike )
1817
1826
1818
1827
1819
1828
class CTzPathTest (TzPathTest ):
0 commit comments