18
18
from functools import cached_property
19
19
20
20
from test .support import MISSING_C_DOCSTRINGS , requires_gil_enabled
21
+ from test .support .os_helper import FakePath
21
22
from test .test_zoneinfo import _support as test_support
22
23
from test .test_zoneinfo ._support import OS_ENV_LOCK , TZPATH_TEST_LOCK , ZoneInfoTestBase
23
24
from test .support .import_helper import import_module , CleanImport
@@ -1798,6 +1799,7 @@ def test_reset_tzpath_relative_paths(self):
1798
1799
("/usr/share/zoneinfo" , "../relative/path" ,),
1799
1800
("path/to/somewhere" , "../relative/path" ,),
1800
1801
("/usr/share/zoneinfo" , "path/to/somewhere" , "../relative/path" ,),
1802
+ (FakePath ("path/to/somewhere" ),)
1801
1803
]
1802
1804
for input_paths in bad_values :
1803
1805
with self .subTest (input_paths = input_paths ):
@@ -1809,6 +1811,9 @@ def test_tzpath_type_error(self):
1809
1811
"/etc/zoneinfo:/usr/share/zoneinfo" ,
1810
1812
b"/etc/zoneinfo:/usr/share/zoneinfo" ,
1811
1813
0 ,
1814
+ (b"/bytes/path" , "/valid/path" ),
1815
+ (FakePath (b"/bytes/path" ),),
1816
+ (0 ,),
1812
1817
]
1813
1818
1814
1819
for bad_value in bad_values :
@@ -1819,15 +1824,20 @@ def test_tzpath_type_error(self):
1819
1824
def test_tzpath_attribute (self ):
1820
1825
tzpath_0 = [f"{ DRIVE } /one" , f"{ DRIVE } /two" ]
1821
1826
tzpath_1 = [f"{ DRIVE } /three" ]
1827
+ tzpath_pathlike = (FakePath (f"{ DRIVE } /usr/share/zoneinfo" ),)
1822
1828
1823
1829
with self .tzpath_context (tzpath_0 ):
1824
1830
query_0 = self .module .TZPATH
1825
1831
1826
1832
with self .tzpath_context (tzpath_1 ):
1827
1833
query_1 = self .module .TZPATH
1828
1834
1835
+ with self .tzpath_context (tzpath_pathlike ):
1836
+ query_pathlike = self .module .TZPATH
1837
+
1829
1838
self .assertSequenceEqual (tzpath_0 , query_0 )
1830
1839
self .assertSequenceEqual (tzpath_1 , query_1 )
1840
+ self .assertSequenceEqual (tuple ([os .fspath (p ) for p in tzpath_pathlike ]), query_pathlike )
1831
1841
1832
1842
1833
1843
class CTzPathTest (TzPathTest ):
0 commit comments