本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)