def test_localize_utc_conversion_explicit(self):
# Localizing to time zone should:
# 1) check for DST ambiguities
# 2) convert to UTC
rng = date_range('3/10/2012', '3/11/2012', freq='30T')
converted = rng.tz_localize(self.tz('US/Eastern'))
expected_naive = rng + offsets.Hour(5)
self.assertTrue(np.array_equal(converted.asi8, expected_naive.asi8))
# DST ambiguity, this should fail
rng = date_range('3/11/2012', '3/12/2012', freq='30T')
# Is this really how it should fail??
self.assertRaises(NonExistentTimeError, rng.tz_localize,
self.tz('US/Eastern'))
test_timezones.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录