本文整理汇总了Python中corehq.util.timezones.conversions.ServerTime.isoformat方法的典型用法代码示例。如果您正苦于以下问题:Python ServerTime.isoformat方法的具体用法?Python ServerTime.isoformat怎么用?Python ServerTime.isoformat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.util.timezones.conversions.ServerTime
的用法示例。
在下文中一共展示了ServerTime.isoformat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_server_to_phone
# 需要导入模块: from corehq.util.timezones.conversions import ServerTime [as 别名]
# 或者: from corehq.util.timezones.conversions.ServerTime import isoformat [as 别名]
def test_server_to_phone(self):
cases = [
('2015-03-20T12:00:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T08:00:00'),
('2015-03-21T00:30:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T20:30:00'),
]
for in_, tz, out in cases:
server_dt = dateutil.parser.parse(in_)
phone_dt = ServerTime(server_dt).phone_time(tz).done()
if phone_timezones_have_been_processed():
# no change
self.assertEqual(phone_dt.isoformat(), in_)
else:
self.assertEqual(phone_dt.isoformat(), out)
示例2: test_server_to_user
# 需要导入模块: from corehq.util.timezones.conversions import ServerTime [as 别名]
# 或者: from corehq.util.timezones.conversions.ServerTime import isoformat [as 别名]
def test_server_to_user(self):
cases = [
('2015-03-20T12:00:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T08:00:00-04:00'),
('2015-03-21T00:30:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T20:30:00-04:00'),
]
for in_, tz, out in cases:
server_dt = dateutil.parser.parse(in_)
user_dt = ServerTime(server_dt).user_time(tz).done()
self.assertEqual(user_dt.isoformat(), out)
示例3: test_server_to_phone
# 需要导入模块: from corehq.util.timezones.conversions import ServerTime [as 别名]
# 或者: from corehq.util.timezones.conversions.ServerTime import isoformat [as 别名]
def test_server_to_phone(self):
cases = [
('2015-03-20T12:00:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T08:00:00'),
('2015-03-21T00:30:00', pytz.FixedOffset(-4 * 60),
'2015-03-20T20:30:00'),
]
for in_, tz, out in cases:
server_dt = dateutil.parser.parse(in_)
if get_timezone_data_migration_complete():
phone_dt = server_dt
else:
phone_dt = ServerTime(server_dt).phone_time(tz).done()
self.assertEqual(phone_dt.isoformat(), out)