2013-08-02 12:03:27 -05:00
|
|
|
import unittest
|
|
|
|
|
|
2016-08-17 11:57:29 -07:00
|
|
|
from leap import is_leap_year
|
2014-06-11 15:06:22 +02:00
|
|
|
|
2014-02-21 14:44:25 +08:00
|
|
|
|
2018-02-16 00:47:44 +08:00
|
|
|
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.3.0
|
2013-08-02 12:03:27 -05:00
|
|
|
|
2018-06-13 09:12:09 -04:00
|
|
|
class LeapTest(unittest.TestCase):
|
2017-03-28 02:55:07 +02:00
|
|
|
def test_year_not_divisible_by_4(self):
|
2017-10-05 22:29:00 +00:00
|
|
|
self.assertIs(is_leap_year(2015), False)
|
2013-08-02 12:03:27 -05:00
|
|
|
|
2017-03-28 02:55:07 +02:00
|
|
|
def test_year_divisible_by_4_not_divisible_by_100(self):
|
2017-10-24 14:44:48 +01:00
|
|
|
self.assertIs(is_leap_year(1996), True)
|
2014-04-22 21:58:09 -06:00
|
|
|
|
2017-03-28 02:55:07 +02:00
|
|
|
def test_year_divisible_by_100_not_divisible_by_400(self):
|
2017-10-05 22:29:00 +00:00
|
|
|
self.assertIs(is_leap_year(2100), False)
|
2014-04-22 21:58:09 -06:00
|
|
|
|
2017-03-28 02:55:07 +02:00
|
|
|
def test_year_divisible_by_400(self):
|
2017-10-05 22:29:00 +00:00
|
|
|
self.assertIs(is_leap_year(2000), True)
|
2013-08-02 12:03:27 -05:00
|
|
|
|
2016-11-29 09:44:47 +01:00
|
|
|
|
2013-08-02 12:03:27 -05:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|