Files
python/exercises/leap/leap_test.py

30 lines
834 B
Python
Raw Normal View History

import unittest
from leap import is_leap_year
2014-02-21 14:44:25 +08:00
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.5.1
2018-06-13 09:12:09 -04:00
class LeapTest(unittest.TestCase):
def test_year_not_divisible_by_4(self):
self.assertIs(is_leap_year(2015), False)
def year_divisible_by_2_not_divisible_by_4(self):
self.assertIs(is_leap_year(1970), False)
def test_year_divisible_by_4_not_divisible_by_100(self):
self.assertIs(is_leap_year(1996), True)
2014-04-22 21:58:09 -06:00
def test_year_divisible_by_100_not_divisible_by_400(self):
self.assertIs(is_leap_year(2100), False)
2014-04-22 21:58:09 -06:00
def test_year_divisible_by_400(self):
self.assertIs(is_leap_year(2000), True)
2018-11-01 16:45:46 +01:00
def test_year_divisible_by_200_not_divisible_by_400(self):
self.assertIs(is_leap_year(1800), False)
2016-11-29 09:44:47 +01:00
if __name__ == '__main__':
unittest.main()