本文整理汇总了Python中tapiriik.services.interchange.ActivityStatistic.coalesceWith方法的典型用法代码示例。如果您正苦于以下问题:Python ActivityStatistic.coalesceWith方法的具体用法?Python ActivityStatistic.coalesceWith怎么用?Python ActivityStatistic.coalesceWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tapiriik.services.interchange.ActivityStatistic
的用法示例。
在下文中一共展示了ActivityStatistic.coalesceWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stat_coalesce_missing
# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import coalesceWith [as 别名]
def test_stat_coalesce_missing(self):
stat1 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None)
stat2 = ActivityStatistic(ActivityStatisticUnit.Meters, value=2)
stat1.coalesceWith(stat2)
self.assertEqual(stat1.Value, 2)
stat1 = ActivityStatistic(ActivityStatisticUnit.Meters, value=1)
stat2 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None)
stat1.coalesceWith(stat2)
self.assertEqual(stat1.Value, 1)
示例2: test_stat_coalesce_multi
# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import coalesceWith [as 别名]
def test_stat_coalesce_multi(self):
stat1 = ActivityStatistic(ActivityStatisticUnit.Meters, value=1)
stat2 = ActivityStatistic(ActivityStatisticUnit.Meters, value=2)
stat3 = ActivityStatistic(ActivityStatisticUnit.Meters, value=3)
stat4 = ActivityStatistic(ActivityStatisticUnit.Meters, value=4)
stat5 = ActivityStatistic(ActivityStatisticUnit.Meters, value=5)
stat1.coalesceWith(stat2)
stat1.coalesceWith(stat3)
stat1.coalesceWith(stat4)
stat1.coalesceWith(stat5)
self.assertEqual(stat1.Value, 3)
示例3: test_stat_coalesce_multi_missingmixed
# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import coalesceWith [as 别名]
def test_stat_coalesce_multi_missingmixed(self):
stat1 = ActivityStatistic(ActivityStatisticUnit.Meters, value=1)
stat2 = ActivityStatistic(ActivityStatisticUnit.Meters, value=2)
stat3 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None)
stat4 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None)
stat5 = ActivityStatistic(ActivityStatisticUnit.Meters, value=5)
stat5.coalesceWith(stat2)
stat3.coalesceWith(stat5)
stat4.coalesceWith(stat3)
stat1.coalesceWith(stat4)
self.assertAlmostEqual(stat1.Value, 8/3)
示例4: test_stat_coalesce_multi_missingmixed_multivalued
# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import coalesceWith [as 别名]
def test_stat_coalesce_multi_missingmixed_multivalued(self):
stat1 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None, min=None)
stat2 = ActivityStatistic(ActivityStatisticUnit.Meters, value=2, max=2)
stat3 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None, gain=3)
stat4 = ActivityStatistic(ActivityStatisticUnit.Meters, value=None, loss=4)
stat5 = ActivityStatistic(ActivityStatisticUnit.Meters, value=5, min=3)
stat5.coalesceWith(stat2)
stat3.coalesceWith(stat5)
stat4.coalesceWith(stat3)
stat1.coalesceWith(stat4)
self.assertAlmostEqual(stat1.Value, 7/2)
self.assertEqual(stat1.Min, 3)
self.assertEqual(stat1.Max, 2)
self.assertEqual(stat1.Gain, 3)
self.assertEqual(stat1.Loss, 4)