From: Serhiy Storchaka Date: Tue, 25 Oct 2016 12:00:52 +0000 (+0300) Subject: Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space X-Git-Tag: v3.6.0b3~55^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ff51bd2b8b8407942e3bab2c9267cc8b95f06be;p=thirdparty%2FPython%2Fcpython.git Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space at the start of new line after printing a month's calendar. Patch by Xiang Zhang. --- diff --git a/Lib/calendar.py b/Lib/calendar.py index b5472f330665..76cf8deb7cf1 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -312,7 +312,7 @@ class TextCalendar(Calendar): """ 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): """ diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index 5de3ce802dfa..accf2518abc7 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -409,8 +409,7 @@ class OutputTestCase(unittest.TestCase): 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: diff --git a/Misc/NEWS b/Misc/NEWS index c44057163479..a20870fcd1a6 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -113,6 +113,10 @@ Core and Builtins Library ------- +- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space + at the start of new line after printing a month's calendar. Patch by + Xiang Zhang. + - Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. Based on patch by Kaarle Ritvanen.