Skip to content

Commit fb26a66

Browse files
authored
Swap '2016' for '1996' to stop faulty logic from passing unit test
[This leap solution](http://exercism.io/submissions/7ef5b0ab93b540f79cdee9f153e0a21c) should not pass the unit test, since it checks whether `year % 100` and `year % 400` are equal in order to tell whether the year it has been passed is a leap year. This works for 2016 because `2016 % 100` and `2016 % 400` both evaluate to 16. 1996, another leap year that is divisible by 4 but not 100, does not have this property and, under that solution, would falsely not be classed as a leap year.
1 parent ce8c579 commit fb26a66

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

exercises/leap/leap_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_year_not_divisible_by_4(self):
1010
self.assertIs(is_leap_year(2015), False)
1111

1212
def test_year_divisible_by_4_not_divisible_by_100(self):
13-
self.assertIs(is_leap_year(2016), True)
13+
self.assertIs(is_leap_year(1996), True)
1414

1515
def test_year_divisible_by_100_not_divisible_by_400(self):
1616
self.assertIs(is_leap_year(2100), False)

0 commit comments

Comments
 (0)