Skip to content

leap: Update test cases #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions exercises/leap/leap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
from leap import is_leap_year


class YearTest(unittest.TestCase):
def test_leap_year(self):
self.assertIs(is_leap_year(1996), True)
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0

def test_non_leap_year(self):
self.assertIs(is_leap_year(1997), False)
class YearTest(unittest.TestCase):
def test_year_not_divisible_by_4(self):
self.assertFalse(is_leap_year(2015))

def test_non_leap_even_year(self):
self.assertIs(is_leap_year(1998), False)
def test_year_divisible_by_4_not_divisible_by_100(self):
self.assertTrue(is_leap_year(2016))

def test_century(self):
self.assertIs(is_leap_year(1900), False)
def test_year_divisible_by_100_not_divisible_by_400(self):
self.assertFalse(is_leap_year(2100))

def test_exceptional_century(self):
self.assertIs(is_leap_year(2400), True)
def test_year_divisible_by_400(self):
self.assertTrue(is_leap_year(2000))


if __name__ == '__main__':
Expand Down