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
cfae36fa
Commit
cfae36fa
authored
Jul 23, 2010
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test calendar.monthrange.
Closes issue 9342. Thanks John Chandler for the patch.
parent
b6ee4f5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
Lib/test/test_calendar.py
Lib/test/test_calendar.py
+29
-0
Misc/ACKS
Misc/ACKS
+1
-0
No files found.
Lib/test/test_calendar.py
View file @
cfae36fa
...
...
@@ -389,6 +389,34 @@ class TimegmTestCase(unittest.TestCase):
tuple
=
time
.
gmtime
(
secs
)
self
.
assertEqual
(
secs
,
calendar
.
timegm
(
tuple
))
class
MonthRangeTestCase
(
unittest
.
TestCase
):
def
test_january
(
self
):
# Tests valid lower boundary case.
self
.
assertEqual
(
calendar
.
monthrange
(
2004
,
1
),
(
3
,
31
))
def
test_february_leap
(
self
):
# Tests February during leap year.
self
.
assertEqual
(
calendar
.
monthrange
(
2004
,
2
),
(
6
,
29
))
def
test_february_nonleap
(
self
):
# Tests February in non-leap year.
self
.
assertEqual
(
calendar
.
monthrange
(
2010
,
2
),
(
0
,
28
))
def
test_december
(
self
):
# Tests valid upper boundary case.
self
.
assertEqual
(
calendar
.
monthrange
(
2004
,
12
),
(
2
,
31
))
def
test_zeroth_month
(
self
):
# Tests low invalid boundary case.
with
self
.
assertRaises
(
calendar
.
IllegalMonthError
):
calendar
.
monthrange
(
2004
,
0
)
def
test_thirteenth_month
(
self
):
# Tests high invalid boundary case.
with
self
.
assertRaises
(
calendar
.
IllegalMonthError
):
calendar
.
monthrange
(
2004
,
13
)
def
test_main
():
support
.
run_unittest
(
OutputTestCase
,
...
...
@@ -396,6 +424,7 @@ def test_main():
MondayTestCase
,
SundayTestCase
,
TimegmTestCase
,
MonthRangeTestCase
,
)
...
...
Misc/ACKS
View file @
cfae36fa
...
...
@@ -129,6 +129,7 @@ Charles Cazabon
Per Cederqvist
Octavian Cerna
Pascal Chambon
John Chandler
Hye-Shik Chang
Jeffrey Chang
Mitch Chapman
...
...
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