Sha256: 4368dc6f2ace22132e2ba88364c3b99e12cc58c387cc127f794d3e449f77a52f

Contents?: true

Size: 1.41 KB

Versions: 60

Compression:

Stored size: 1.41 KB

Contents

import unittest

from datetime import datetime

from gigasecond import add_gigasecond


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0

class GigasecondTest(unittest.TestCase):
    def test_date_only_specification_of_time(self):
        self.assertEqual(
            add_gigasecond(datetime(2011, 4, 25)),
            datetime(2043, 1, 1, 1, 46, 40))

    def test_another_date_only_specification_of_time(self):
        self.assertEqual(
            add_gigasecond(datetime(1977, 6, 13)),
            datetime(2009, 2, 19, 1, 46, 40))

    def test_one_more_date_only_specification_of_time(self):
        self.assertEqual(
            add_gigasecond(datetime(1959, 7, 19)),
            datetime(1991, 3, 27, 1, 46, 40))

    def test_full_time_specified(self):
        self.assertEqual(
            add_gigasecond(datetime(2015, 1, 24, 22, 0, 0)),
            datetime(2046, 10, 2, 23, 46, 40))

    def test_full_time_with_day_roll_over(self):
        self.assertEqual(
            add_gigasecond(datetime(2015, 1, 24, 23, 59, 59)),
            datetime(2046, 10, 3, 1, 46, 39))

    def test_yourself(self):
        # customize this to test your birthday and find your gigasecond date:
        your_birthday = datetime(1970, 1, 1)
        your_gigasecond = datetime(2001, 9, 9, 1, 46, 40)

        self.assertEqual(add_gigasecond(your_birthday), your_gigasecond)


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

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
trackler-2.2.1.105 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.104 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.103 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.102 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.101 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.100 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.99 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.98 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.97 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.96 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.95 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.94 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.93 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.92 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.91 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.90 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.89 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.88 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.87 tracks/python/exercises/gigasecond/gigasecond_test.py
trackler-2.2.1.86 tracks/python/exercises/gigasecond/gigasecond_test.py