当前位置: 首页>>代码示例>>Python>>正文


Python ActivityStatistic.coalesceWith方法代码示例

本文整理汇总了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)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:12,代码来源:statistics.py

示例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)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:13,代码来源:statistics.py

示例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)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:14,代码来源:statistics.py

示例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)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:18,代码来源:statistics.py


注:本文中的tapiriik.services.interchange.ActivityStatistic.coalesceWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。