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


Python ActivityStatistic.asUnits方法代码示例

本文整理汇总了Python中tapiriik.services.interchange.ActivityStatistic.asUnits方法的典型用法代码示例。如果您正苦于以下问题:Python ActivityStatistic.asUnits方法的具体用法?Python ActivityStatistic.asUnits怎么用?Python ActivityStatistic.asUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tapiriik.services.interchange.ActivityStatistic的用法示例。


在下文中一共展示了ActivityStatistic.asUnits方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_unitconv_distance_cross

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_distance_cross(self):
        stat = ActivityStatistic(ActivityStatisticUnit.Kilometers, value=1)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.Miles).Value, 0.6214, places=4)

        stat = ActivityStatistic(ActivityStatisticUnit.Miles, value=1)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.Kilometers).Value, 1.609, places=3)

        stat = ActivityStatistic(ActivityStatisticUnit.Miles, value=1)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.Meters).Value, 1609, places=0)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:11,代码来源:statistics.py

示例2: test_unitconv_temp

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_temp(self):
        stat = ActivityStatistic(ActivityStatisticUnit.DegreesCelcius, value=0)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.DegreesFahrenheit).Value, 32)

        stat = ActivityStatistic(ActivityStatisticUnit.DegreesCelcius, value=-40)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.DegreesFahrenheit).Value, -40)

        stat = ActivityStatistic(ActivityStatisticUnit.DegreesFahrenheit, value=-40)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.DegreesCelcius).Value, -40)

        stat = ActivityStatistic(ActivityStatisticUnit.DegreesFahrenheit, value=32)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.DegreesCelcius).Value, 0)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:14,代码来源:statistics.py

示例3: test_unitconv_noop

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
 def test_unitconv_noop(self):
     stat = ActivityStatistic(ActivityStatisticUnit.KilometersPerHour, value=100)
     self.assertEqual(stat.asUnits(ActivityStatisticUnit.KilometersPerHour).Value, 100)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:5,代码来源:statistics.py

示例4: test_unitconv_velocity_cross

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_velocity_cross(self):
        stat = ActivityStatistic(ActivityStatisticUnit.KilometersPerHour, value=100)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.MilesPerHour).Value, 62, places=0)

        stat = ActivityStatistic(ActivityStatisticUnit.MilesPerHour, value=60)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.KilometersPerHour).Value, 96.5, places=0)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:8,代码来源:statistics.py

示例5: test_unitconv_velocity_metric

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_velocity_metric(self):
        stat = ActivityStatistic(ActivityStatisticUnit.MetersPerSecond, value=100)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.KilometersPerHour).Value, 360)

        stat = ActivityStatistic(ActivityStatisticUnit.KilometersPerHour, value=50)
        self.assertAlmostEqual(stat.asUnits(ActivityStatisticUnit.MetersPerSecond).Value, 13.89, places=2)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:8,代码来源:statistics.py

示例6: test_unitconv_distance_metric

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_distance_metric(self):
        stat = ActivityStatistic(ActivityStatisticUnit.Kilometers, value=1)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.Meters).Value, 1000)

        stat = ActivityStatistic(ActivityStatisticUnit.Meters, value=250)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.Kilometers).Value, 0.25)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:8,代码来源:statistics.py

示例7: test_unitconv_distance_nonmetric

# 需要导入模块: from tapiriik.services.interchange import ActivityStatistic [as 别名]
# 或者: from tapiriik.services.interchange.ActivityStatistic import asUnits [as 别名]
    def test_unitconv_distance_nonmetric(self):
        stat = ActivityStatistic(ActivityStatisticUnit.Miles, value=1)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.Feet).Value, 5280)

        stat = ActivityStatistic(ActivityStatisticUnit.Feet, value=5280/2)
        self.assertEqual(stat.asUnits(ActivityStatisticUnit.Miles).Value, 0.5)
开发者ID:StanAccy,项目名称:tapiriik,代码行数:8,代码来源:statistics.py


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