]> granicus.if.org Git - python/commitdiff
Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Oct 2016 12:00:52 +0000 (15:00 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Oct 2016 12:00:52 +0000 (15:00 +0300)
at the start of new line after printing a month's calendar.  Patch by
Xiang Zhang.

Lib/calendar.py
Lib/test/test_calendar.py
Misc/NEWS

index b5472f3306654aa59be2efdd16ea5c1b0471380d..76cf8deb7cf159d4a16c0970dfe712cb9f1f4b56 100644 (file)
@@ -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):
         """
index 5de3ce802dfa2a02cca7ffc02efba6c4bdc6f561..accf2518abc76c9b90c0f19c58819a572b1a7ea6 100644 (file)
@@ -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:
index c44057163479f64a87ef1e24148989b42d192bc1..a20870fcd1a649b981f8a98b6da5a8083fc7070e 100644 (file)
--- 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.