本文整理汇总了Python中dipplanner.tank.Tank.consume_gas方法的典型用法代码示例。如果您正苦于以下问题:Python Tank.consume_gas方法的具体用法?Python Tank.consume_gas怎么用?Python Tank.consume_gas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipplanner.tank.Tank
的用法示例。
在下文中一共展示了Tank.consume_gas方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTankVolume3
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankVolume3(TestTank):
def setUp(self):
self.mytank = Tank(tank_vol=15, tank_pressure=207)
def test_vol(self):
self.mytank.consume_gas(405)
self.assertAlmostEqual(self.mytank.remaining_gas, 2711, 0, "Wrong Tank Volume : %s" % self.mytank.remaining_gas)
示例2: TestTankRefill
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankRefill(TestTank):
"""Test Tank Refill."""
def setUp(self):
"""Init of the tests."""
super().setUp()
self.mytank = Tank(tank_vol=15, tank_pressure=207)
self.mytank.consume_gas(405)
self.mytank.consume_gas(2800)
def test_vol(self):
"""Test volume calc."""
self.assertAlmostEqual(self.mytank.remaining_gas,
-88.9813390544, 0,
'Wrong Tank Volume : %s'
% self.mytank.remaining_gas)
def test_refill(self):
"""Test volume calc after refill."""
self.mytank.refill()
self.assertAlmostEqual(self.mytank.remaining_gas,
3116.01866095, 0,
'Wrong Tank Volume : %s'
% self.mytank.remaining_gas)
示例3: TestTankVolume4
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankVolume4(TestTank):
def setUp(self):
self.mytank = Tank(tank_vol=15, tank_pressure=207)
def test_vol(self):
self.mytank.consume_gas(405)
self.mytank.consume_gas(2800)
self.assertEqual(
self.mytank.check_rule(),
False,
"Wrong tank status : it should fail the remaining " "gas rule test (result:%s)" % self.mytank.check_rule(),
)
示例4: TestTankVolume3
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankVolume3(TestTank):
"""Test Tank Volume 3."""
def setUp(self):
"""Init of the tests."""
super().setUp()
self.mytank = Tank(tank_vol=15, tank_pressure=207)
def test_vol(self):
"""Test volume calc."""
self.mytank.consume_gas(405)
self.assertAlmostEqual(self.mytank.remaining_gas, 2711, 0,
'Wrong Tank Volume : %s'
% self.mytank.remaining_gas)
示例5: TestTankRefill
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankRefill(TestTank):
def setUp(self):
self.mytank = Tank(tank_vol=15, tank_pressure=207)
self.mytank.consume_gas(405)
self.mytank.consume_gas(2800)
def test_vol(self):
self.assertAlmostEqual(
self.mytank.remaining_gas, -88.9813390544, 0, "Wrong Tank Volume : %s" % self.mytank.remaining_gas
)
def test_refill(self):
self.mytank.refill()
self.assertAlmostEqual(
self.mytank.remaining_gas, 3116.01866095, 0, "Wrong Tank Volume : %s" % self.mytank.remaining_gas
)
示例6: TestTankVolume4
# 需要导入模块: from dipplanner.tank import Tank [as 别名]
# 或者: from dipplanner.tank.Tank import consume_gas [as 别名]
class TestTankVolume4(TestTank):
"""Test Tank Volume 4."""
def setUp(self):
"""Init of the tests."""
super().setUp()
self.mytank = Tank(tank_vol=15, tank_pressure=207)
def test_vol(self):
"""Test volume calc."""
self.mytank.consume_gas(405)
self.mytank.consume_gas(2800)
self.assertEqual(self.mytank.check_rule(), False,
'Wrong tank status : it should fail the remaining '
'gas rule test (result:%s)'
% self.mytank.check_rule())