本文整理汇总了Python中tapiriik.services.interchange.Activity.EndTime方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.EndTime方法的具体用法?Python Activity.EndTime怎么用?Python Activity.EndTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tapiriik.services.interchange.Activity
的用法示例。
在下文中一共展示了Activity.EndTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_blank_activity
# 需要导入模块: from tapiriik.services.interchange import Activity [as 别名]
# 或者: from tapiriik.services.interchange.Activity import EndTime [as 别名]
def create_blank_activity(svc=None, actType=ActivityType.Other, record=None):
act = Activity()
act.Type = actType
if svc:
act.UploadedTo = [TestTools.create_mock_upload_record(svc, record)]
act.StartTime = datetime.now()
act.EndTime = act.StartTime + timedelta(seconds=42)
act.CalculateUID()
return act
示例2: create_blank_activity
# 需要导入模块: from tapiriik.services.interchange import Activity [as 别名]
# 或者: from tapiriik.services.interchange.Activity import EndTime [as 别名]
def create_blank_activity(svc=None, actType=ActivityType.Other, record=None):
act = Activity()
act.Type = actType
if svc:
record = record if record else TestTools.create_mock_svc_record(svc)
act.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svc, record=record)
act.StartTime = datetime.now()
act.EndTime = act.StartTime + timedelta(seconds=42)
act.CalculateUID()
return act
示例3: test_activity_deduplicate_normaltz
# 需要导入模块: from tapiriik.services.interchange import Activity [as 别名]
# 或者: from tapiriik.services.interchange.Activity import EndTime [as 别名]
def test_activity_deduplicate_normaltz(self):
''' ensure that we can't deduplicate activities with non-pytz timezones '''
svcA, svcB = TestTools.create_mock_services()
actA = TestTools.create_random_activity(svcA, tz=UTC())
actB = Activity()
actB.StartTime = actA.StartTime.replace(tzinfo=None) + timedelta(seconds=10)
actB.EndTime = actA.EndTime.replace(tzinfo=None)
actB.UploadedTo = [TestTools.create_mock_upload_record(svcB)]
actA.Name = "Not this"
actB.Name = "Heya"
actB.Type = ActivityType.Walking
actA.CalculateUID()
actB.CalculateUID()
activities = []
Sync._accumulateActivities(Service.FromID("mockB"), [copy.deepcopy(actB)], activities)
self.assertRaises(ValueError, Sync._accumulateActivities, Service.FromID("mockA"), [copy.deepcopy(actA)], activities)
示例4: test_activity_deduplicate_normaltz
# 需要导入模块: from tapiriik.services.interchange import Activity [as 别名]
# 或者: from tapiriik.services.interchange.Activity import EndTime [as 别名]
def test_activity_deduplicate_normaltz(self):
''' ensure that we can't deduplicate activities with non-pytz timezones '''
svcA, svcB = TestTools.create_mock_services()
recA = TestTools.create_mock_svc_record(svcA)
recB = TestTools.create_mock_svc_record(svcB)
actA = TestTools.create_random_activity(svcA, tz=UTC())
actB = Activity()
actB.StartTime = actA.StartTime.replace(tzinfo=None) + timedelta(seconds=10)
actB.EndTime = actA.EndTime.replace(tzinfo=None)
actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)
actA.Name = "Not this"
actB.Name = "Heya"
actB.Type = ActivityType.Walking
actA.CalculateUID()
actB.CalculateUID()
s = SynchronizationTask(None)
s._activities = []
s._accumulateActivities(recB, [copy.deepcopy(actB)])
self.assertRaises(ValueError, s._accumulateActivities, recA, [copy.deepcopy(actA)])