File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 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):
805805 self .assertEqual (ts , ts .tz_convert (dateutil .tz .tzutc ()))
806806
807807
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+
808823class TestTimeZones (tm .TestCase ):
809824 _multiprocess_can_split_ = True
810825
Original file line number Diff line number Diff line change @@ -1962,6 +1962,11 @@ cdef inline bint _treat_tz_as_dateutil(object tz):
19621962 return hasattr (tz, ' _trans_list' ) and hasattr (tz, ' _trans_idx' )
19631963
19641964
1965+ def _p_tz_cache_key (tz ):
1966+ ''' Python interface for cache function to facilitate testing.'''
1967+ return _tz_cache_key(tz)
1968+
1969+
19651970cdef inline object _tz_cache_key(object tz):
19661971 """
19671972 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):
19821987 raise ValueError (' Bad tz filename. Dateutil on python 3 on windows has a bug which causes tzfile._filename to be the same for all '
19831988 ' timezone files. Please construct dateutil timezones implicitly by passing a string like "dateutil/Europe/London" '
19841989 ' 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
19861991 else :
19871992 return None
19881993
You can’t perform that action at this time.
0 commit comments