diff -r df2fdd42b375 Lib/test/test_calendar.py --- a/Lib/test/test_calendar.py Mon Aug 26 22:28:21 2013 +0200 +++ b/Lib/test/test_calendar.py Tue Aug 27 15:12:23 2013 -0400 @@ -3,6 +3,8 @@ from test import support from test.script_helper import assert_python_ok +from io import StringIO +import unittest.mock import time import locale import sys @@ -399,6 +401,34 @@ 'January' ) + def test_prweek(self): + s = StringIO() + with unittest.mock.patch('sys.stdout', s): + week = [(1,0), (2,1), (3,2), (4,3), (5,4), (6,5), (7,6)] + calendar.TextCalendar().prweek(week, 1) + self.assertEqual(s.getvalue().strip(), "1 2 3 4 5 6 7") + s.close() + + def test_prmonth(self): + s = StringIO() + with unittest.mock.patch('sys.stdout', s): + calendar.TextCalendar().prmonth(2004, 1) + self.assertEqual(s.getvalue().strip(), result_2004_01_text.strip()) + s.close() + + def test_pryear(self): + s = StringIO() + with unittest.mock.patch('sys.stdout', s): + calendar.TextCalendar().pryear(2004) + self.assertEqual(s.getvalue().strip(), result_2004_text.strip()) + s.close() + + def test_format(self): + s = StringIO() + with unittest.mock.patch('sys.stdout', s): + calendar.format(["1", "2", "3"], colwidth=3, spacing=1) + self.assertEqual(s.getvalue().strip(), "1 2 3") + s.close() class CalendarTestCase(unittest.TestCase): def test_isleap(self):