File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,21 @@ def test_utc_with_system_utc(self):
805
805
self .assertEqual (ts , ts .tz_convert (dateutil .tz .tzutc ()))
806
806
807
807
808
+ class TestTimeZoneCacheKey (tm .TestCase ):
809
+ def test_cache_keys_are_distinct_for_pytz_vs_dateutil (self ):
810
+ tzs = pytz .common_timezones
811
+ for tz_name in tzs :
812
+ if tz_name == 'UTC' :
813
+ # skip utc as it's a special case in dateutil
814
+ continue
815
+ tz_p = tslib .maybe_get_tz (tz_name )
816
+ tz_d = tslib .maybe_get_tz ('dateutil/' + tz_name )
817
+ if tz_d is None :
818
+ # skip timezones that dateutil doesn't know about.
819
+ continue
820
+ self .assertNotEqual (tslib ._p_tz_cache_key (tz_p ), tslib ._p_tz_cache_key (tz_d ))
821
+
822
+
808
823
class TestTimeZones (tm .TestCase ):
809
824
_multiprocess_can_split_ = True
810
825
Original file line number Diff line number Diff line change @@ -1962,6 +1962,11 @@ cdef inline bint _treat_tz_as_dateutil(object tz):
1962
1962
return hasattr (tz, ' _trans_list' ) and hasattr (tz, ' _trans_idx' )
1963
1963
1964
1964
1965
+ def _p_tz_cache_key (tz ):
1966
+ ''' Python interface for cache function to facilitate testing.'''
1967
+ return _tz_cache_key(tz)
1968
+
1969
+
1965
1970
cdef inline object _tz_cache_key(object tz):
1966
1971
"""
1967
1972
Return the key in the cache for the timezone info object or None if unknown.
@@ -1982,7 +1987,7 @@ cdef inline object _tz_cache_key(object tz):
1982
1987
raise ValueError (' Bad tz filename. Dateutil on python 3 on windows has a bug which causes tzfile._filename to be the same for all '
1983
1988
' timezone files. Please construct dateutil timezones implicitly by passing a string like "dateutil/Europe/London" '
1984
1989
' when you construct your pandas objects instead of passing a timezone object. See https://github.com/pydata/pandas/pull/7362' )
1985
- return tz._filename
1990
+ return ' dateutil ' + tz._filename
1986
1991
else :
1987
1992
return None
1988
1993
You can’t perform that action at this time.
0 commit comments