Skip to content

Commit 82cd18b

Browse files
authored
leap: Update test cases (#441)
Adds the changes made to the the canonical test data in exercism/problem-specifications#463 and stores the test data version.
1 parent 62445f5 commit 82cd18b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

exercises/leap/leap_test.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
from leap import is_leap_year
44

55

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

10-
def test_non_leap_year(self):
11-
self.assertIs(is_leap_year(1997), False)
8+
class YearTest(unittest.TestCase):
9+
def test_year_not_divisible_by_4(self):
10+
self.assertFalse(is_leap_year(2015))
1211

13-
def test_non_leap_even_year(self):
14-
self.assertIs(is_leap_year(1998), False)
12+
def test_year_divisible_by_4_not_divisible_by_100(self):
13+
self.assertTrue(is_leap_year(2016))
1514

16-
def test_century(self):
17-
self.assertIs(is_leap_year(1900), False)
15+
def test_year_divisible_by_100_not_divisible_by_400(self):
16+
self.assertFalse(is_leap_year(2100))
1817

19-
def test_exceptional_century(self):
20-
self.assertIs(is_leap_year(2400), True)
18+
def test_year_divisible_by_400(self):
19+
self.assertTrue(is_leap_year(2000))
2120

2221

2322
if __name__ == '__main__':

0 commit comments

Comments
 (0)