* Corrected small typos around resistor bands. * Due to failing CI, alterations to the test generator script were needed. The generated vs submitted diff now skips the first three lines of the file so that the generation date is not picked up and flagged as needing regeneration. Sadly, a workaround was also needed to prevent Python difflib from noting the difference anyways and producing an empty "false positive" diff. All templates and test files also needed to be altered to ensure that the first three lines of every test file will always be the autogeneration comment and date. Hopefully, this will now stop the CI failures without creating any subtle additional bugs. * Touch up to bowling template. Added back the error raising utility. * Touch up to two-bucket template to add back in error raising utility. [no important files changed]
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
# These tests are auto-generated with test data from:
|
|
# https://github.com/exercism/problem-specifications/tree/main/exercises/space-age/canonical-data.json
|
|
# File last updated on 2023-07-19
|
|
|
|
import unittest
|
|
|
|
from space_age import (
|
|
SpaceAge,
|
|
)
|
|
|
|
|
|
class SpaceAgeTest(unittest.TestCase):
|
|
def test_age_on_earth(self):
|
|
self.assertEqual(SpaceAge(1000000000).on_earth(), 31.69)
|
|
|
|
def test_age_on_mercury(self):
|
|
self.assertEqual(SpaceAge(2134835688).on_mercury(), 280.88)
|
|
|
|
def test_age_on_venus(self):
|
|
self.assertEqual(SpaceAge(189839836).on_venus(), 9.78)
|
|
|
|
def test_age_on_mars(self):
|
|
self.assertEqual(SpaceAge(2129871239).on_mars(), 35.88)
|
|
|
|
def test_age_on_jupiter(self):
|
|
self.assertEqual(SpaceAge(901876382).on_jupiter(), 2.41)
|
|
|
|
def test_age_on_saturn(self):
|
|
self.assertEqual(SpaceAge(2000000000).on_saturn(), 2.15)
|
|
|
|
def test_age_on_uranus(self):
|
|
self.assertEqual(SpaceAge(1210123456).on_uranus(), 0.46)
|
|
|
|
def test_age_on_neptune(self):
|
|
self.assertEqual(SpaceAge(1821023456).on_neptune(), 0.35)
|