def test_instance_timezone_aware_datetime_pytz_offset(self):
# Impossible timezone of +21 (won't accidentally match the local offset)
fixed_offset = pytz.FixedOffset(21 * 60)
now = Pendulum.instance(
datetime.now(fixed_offset)
)
self.assertEqual(21, now.offset_hours)
now = Pendulum.instance(
datetime.now(), fixed_offset
)
self.assertEqual(21, now.offset_hours)
now = Pendulum.instance(
datetime.now(fixed_offset), pytz.timezone('Europe/Paris')
)
self.assertEqual(21, now.offset_hours)
评论列表
文章目录