diff -r 15f82b64eee0 Lib/calendar.py --- a/Lib/calendar.py Thu Sep 22 17:11:53 2016 -0700 +++ b/Lib/calendar.py Fri Sep 23 17:26:32 2016 +0800 @@ -268,7 +268,7 @@ """ Print a single week (no newline). """ - print(self.formatweek(theweek, width), end=' ') + print(self.formatweek(theweek, width)) def formatday(self, day, weekday, width): """ @@ -315,7 +315,7 @@ """ Print a month's calendar. """ - print(self.formatmonth(theyear, themonth, w, l), end=' ') + print(self.formatmonth(theyear, themonth, w, l), end='') def formatmonth(self, theyear, themonth, w=0, l=0): """ @@ -372,7 +372,7 @@ def pryear(self, theyear, w=0, l=0, c=6, m=3): """Print a year's calendar.""" - print(self.formatyear(theyear, w, l, c, m)) + print(self.formatyear(theyear, w, l, c, m), end='') class HTMLCalendar(Calendar): diff -r 15f82b64eee0 Lib/test/test_calendar.py --- a/Lib/test/test_calendar.py Thu Sep 22 17:11:53 2016 -0700 +++ b/Lib/test/test_calendar.py Fri Sep 23 17:26:32 2016 +0800 @@ -404,18 +404,17 @@ with support.captured_stdout() as out: week = [(1,0), (2,1), (3,2), (4,3), (5,4), (6,5), (7,6)] calendar.TextCalendar().prweek(week, 1) - self.assertEqual(out.getvalue().strip(), "1 2 3 4 5 6 7") + self.assertEqual(out.getvalue(), " 1 2 3 4 5 6 7\n") def test_prmonth(self): with support.captured_stdout() as out: calendar.TextCalendar().prmonth(2004, 1) - output = out.getvalue().strip() - self.assertEqual(output, result_2004_01_text.strip()) + self.assertEqual(out.getvalue(), result_2004_01_text) def test_pryear(self): with support.captured_stdout() as out: calendar.TextCalendar().pryear(2004) - self.assertEqual(out.getvalue().strip(), result_2004_text.strip()) + self.assertEqual(out.getvalue(), result_2004_text) def test_format(self): with support.captured_stdout() as out: