Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1daaf9e6
Commit
1daaf9e6
authored
Dec 31, 2010
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#9361: add some tests for calendar.leapdays
Patch by John Chandler.
parent
7b0e86ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Lib/test/test_calendar.py
Lib/test/test_calendar.py
+21
-0
No files found.
Lib/test/test_calendar.py
View file @
1daaf9e6
...
...
@@ -430,6 +430,26 @@ class MonthRangeTestCase(unittest.TestCase):
with
self
.
assertRaises
(
calendar
.
IllegalMonthError
):
calendar
.
monthrange
(
2004
,
13
)
class
LeapdaysTestCase
(
unittest
.
TestCase
):
def
test_no_range
(
self
):
# test when no range i.e. two identical years as args
self
.
assertEqual
(
calendar
.
leapdays
(
2010
,
2010
),
0
)
def
test_no_leapdays
(
self
):
# test when no leap years in range
self
.
assertEqual
(
calendar
.
leapdays
(
2010
,
2011
),
0
)
def
test_no_leapdays_upper_boundary
(
self
):
# test no leap years in range, when upper boundary is a leap year
self
.
assertEqual
(
calendar
.
leapdays
(
2010
,
2012
),
0
)
def
test_one_leapday_lower_boundary
(
self
):
# test when one leap year in range, lower boundary is leap year
self
.
assertEqual
(
calendar
.
leapdays
(
2012
,
2013
),
1
)
def
test_several_leapyears_in_range
(
self
):
self
.
assertEqual
(
calendar
.
leapdays
(
1997
,
2020
),
5
)
def
test_main
():
support
.
run_unittest
(
...
...
@@ -439,6 +459,7 @@ def test_main():
SundayTestCase
,
TimegmTestCase
,
MonthRangeTestCase
,
LeapdaysTestCase
,
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment