<reponame>ankitsumitg/python-projects<filename>gas_mileage/test_milesPerGallon.py<gh_stars>1-10
"""
Do Not Edit this file. You may and are encouraged to look at it for reference.
"""

import unittest
import gas_mileage


class TestMilesPerGallon(unittest.TestCase):
    def test001_milesPerGallonExists(self):
        self.assertTrue('milesPerGallon' in dir(gas_mileage),
                        'Function "milesPerGallon" is not defined, check your spelling')
        return

    def test002_milesPerGallonCalculate(self):
        expected = 30.0
        actual = gas_mileage.milesPerGallon(30.0, 1.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test003_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(30.0, 0.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test004_milesPerGallonCalculate(self):
        expected = 4.66
        actual = gas_mileage.milesPerGallon(317.0, 68.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test005_milesPerGallonCalculate(self):
        expected = 26.42
        actual = gas_mileage.milesPerGallon(317.0, 12.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test006_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(0.0, 0.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test007_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(0.0, 1.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

if __name__ == '__main__':
    unittest.main()

"""
Do Not Edit this file. You may and are encouraged to look at it for reference.
"""

import unittest
import gas_mileage


class TestMilesPerGallon(unittest.TestCase):
    def test001_milesPerGallonExists(self):
        self.assertTrue('milesPerGallon' in dir(gas_mileage),
                        'Function "milesPerGallon" is not defined, check your spelling')
        return

    def test002_milesPerGallonCalculate(self):
        expected = 30.0
        actual = gas_mileage.milesPerGallon(30.0, 1.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test003_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(30.0, 0.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test004_milesPerGallonCalculate(self):
        expected = 4.66
        actual = gas_mileage.milesPerGallon(317.0, 68.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test005_milesPerGallonCalculate(self):
        expected = 26.42
        actual = gas_mileage.milesPerGallon(317.0, 12.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test006_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(0.0, 0.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

    def test007_milesPerGallonCalculate(self):
        expected = 0.0
        actual = gas_mileage.milesPerGallon(0.0, 1.0)
        self.assertAlmostEqual(expected, actual, 2,
            'Your milesToGallon function returned %s which is not close enough to %s' % (actual, expected))
        return

if __name__ == '__main__':
    unittest.main()
Do Not Edit this file. You may and are encouraged to look at it for reference.