Sha256: 7c4743d9fdb048dd2bad20371549d6c6a41413d2c6f5310637d862de2b901c91

Contents?: true

Size: 1.49 KB

Versions: 101

Compression:

Stored size: 1.49 KB

Contents

import unittest

from space_age import SpaceAge


class SpaceAgeTest(unittest.TestCase):
    def test_age_in_seconds(self):
        age = SpaceAge(1e6)
        self.assertEqual(1e6, age.seconds)

    def test_age_in_earth_years(self):
        age = SpaceAge(1e9)
        self.assertEqual(31.69, age.on_earth())

    def test_age_in_mercury_years(self):
        age = SpaceAge(2134835688)
        self.assertEqual(67.65, age.on_earth())
        self.assertEqual(280.88, age.on_mercury())

    def test_age_in_venus_years(self):
        age = SpaceAge(189839836)
        self.assertEqual(6.02, age.on_earth())
        self.assertEqual(9.78, age.on_venus())

    def test_age_on_mars(self):
        age = SpaceAge(2329871239)
        self.assertEqual(73.83, age.on_earth())
        self.assertEqual(39.25, age.on_mars())

    def test_age_on_jupiter(self):
        age = SpaceAge(901876382)
        self.assertEqual(28.58, age.on_earth())
        self.assertEqual(2.41, age.on_jupiter())

    def test_age_on_saturn(self):
        age = SpaceAge(3e9)
        self.assertEqual(95.06, age.on_earth())
        self.assertEqual(3.23, age.on_saturn())

    def test_age_on_uranus(self):
        age = SpaceAge(3210123456)
        self.assertEqual(101.72, age.on_earth())
        self.assertEqual(1.21, age.on_uranus())

    def test_age_on_neptune(self):
        age = SpaceAge(8210123456)
        self.assertEqual(260.16, age.on_earth())
        self.assertEqual(1.58, age.on_neptune())


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

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
trackler-2.0.8.27 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.26 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.24 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.23 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.22 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.21 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.20 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.19 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.18 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.17 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.16 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.15 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.14 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.13 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.12 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.11 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.10 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.9 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.8 tracks/python/exercises/space-age/space_age_test.py
trackler-2.0.8.7 tracks/python/exercises/space-age/space_age_test.py