def _testTzFunc(self, tzval, func, std_val, dst_val):
"""
This generates tests about how the behavior of a function ``func``
changes between STD and DST (e.g. utcoffset, tzname, dst).
It assume that DST starts the 2nd Sunday in March and ends the 1st
Sunday in November
"""
with TZEnvContext(tzval):
dt1 = datetime(2015, 2, 1, 12, 0, tzinfo=tz.tzlocal()) # STD
dt2 = datetime(2015, 5, 1, 12, 0, tzinfo=tz.tzlocal()) # DST
self.assertEqual(func(dt1), std_val)
self.assertEqual(func(dt2), dst_val)
评论列表
文章目录