Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_calendar.MondayTestCase Class Reference
Inheritance diagram for test.test_calendar.MondayTestCase:
Inheritance graph
[legend]
Collaboration diagram for test.test_calendar.MondayTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_february
def test_april
def test_december
def setUp
def tearDown
def check_weeks

Public Attributes

 oldfirstweekday

Static Public Attributes

 firstweekday = calendar.MONDAY

Detailed Description

Definition at line 284 of file test_calendar.py.


Member Function Documentation

def test.test_calendar.MonthCalendarTestCase.check_weeks (   self,
  year,
  month,
  weeks 
) [inherited]

Definition at line 277 of file test_calendar.py.

00277 
00278     def check_weeks(self, year, month, weeks):
00279         cal = calendar.monthcalendar(year, month)
00280         self.assertEqual(len(cal), len(weeks))
00281         for i in range(len(weeks)):
00282             self.assertEqual(weeks[i], sum(day != 0 for day in cal[i]))
00283 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 270 of file test_calendar.py.

00270 
00271     def setUp(self):
00272         self.oldfirstweekday = calendar.firstweekday()
00273         calendar.setfirstweekday(self.firstweekday)

Here is the caller graph for this function:

Definition at line 274 of file test_calendar.py.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 306 of file test_calendar.py.

00306 
00307     def test_april(self):
00308         # A 30-day april starting on monday (7+7+7+7+2 days)
00309         self.check_weeks(1935, 4, (7, 7, 7, 7, 2))
00310 
00311         # A 30-day april starting on tuesday (6+7+7+7+3 days)
00312         self.check_weeks(1975, 4, (6, 7, 7, 7, 3))
00313 
00314         # A 30-day april starting on sunday (1+7+7+7+7+1 days)
00315         self.check_weeks(1945, 4, (1, 7, 7, 7, 7, 1))
00316 
00317         # A 30-day april starting on saturday (2+7+7+7+7 days)
00318         self.check_weeks(1995, 4, (2, 7, 7, 7, 7))
00319 
00320         # A 30-day april starting on friday (3+7+7+7+6 days)
00321         self.check_weeks(1994, 4, (3, 7, 7, 7, 6))

Here is the call graph for this function:

Definition at line 322 of file test_calendar.py.

00322 
00323     def test_december(self):
00324         # A 31-day december starting on monday (7+7+7+7+3 days)
00325         self.check_weeks(1980, 12, (7, 7, 7, 7, 3))
00326 
00327         # A 31-day december starting on tuesday (6+7+7+7+4 days)
00328         self.check_weeks(1987, 12, (6, 7, 7, 7, 4))
00329 
00330         # A 31-day december starting on sunday (1+7+7+7+7+2 days)
00331         self.check_weeks(1968, 12, (1, 7, 7, 7, 7, 2))
00332 
00333         # A 31-day december starting on thursday (4+7+7+7+6 days)
00334         self.check_weeks(1988, 12, (4, 7, 7, 7, 6))
00335 
00336         # A 31-day december starting on friday (3+7+7+7+7 days)
00337         self.check_weeks(2017, 12, (3, 7, 7, 7, 7))
00338 
00339         # A 31-day december starting on saturday (2+7+7+7+7+1 days)
00340         self.check_weeks(2068, 12, (2, 7, 7, 7, 7, 1))
00341 

Here is the call graph for this function:

Definition at line 287 of file test_calendar.py.

00287 
00288     def test_february(self):
00289         # A 28-day february starting on monday (7+7+7+7 days)
00290         self.check_weeks(1999, 2, (7, 7, 7, 7))
00291 
00292         # A 28-day february starting on tuesday (6+7+7+7+1 days)
00293         self.check_weeks(2005, 2, (6, 7, 7, 7, 1))
00294 
00295         # A 28-day february starting on sunday (1+7+7+7+6 days)
00296         self.check_weeks(1987, 2, (1, 7, 7, 7, 6))
00297 
00298         # A 29-day february starting on monday (7+7+7+7+1 days)
00299         self.check_weeks(1988, 2, (7, 7, 7, 7, 1))
00300 
00301         # A 29-day february starting on tuesday (6+7+7+7+2 days)
00302         self.check_weeks(1972, 2, (6, 7, 7, 7, 2))
00303 
00304         # A 29-day february starting on sunday (1+7+7+7+7 days)
00305         self.check_weeks(2004, 2, (1, 7, 7, 7, 7))

Here is the call graph for this function:


Member Data Documentation

Definition at line 285 of file test_calendar.py.

Definition at line 271 of file test_calendar.py.


The documentation for this class was generated from the following file: