Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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(),
        )
Esempio n. 4
0
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)
Esempio n. 5
0
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)
Esempio n. 6
0
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
        )
Esempio n. 7
0
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())
Esempio n. 8
0
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())
Esempio n. 9
0
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)