]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#18856: improve test coverage of the calendar module. Patch by Madison May.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 14 Sep 2013 01:55:53 +0000 (04:55 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 14 Sep 2013 01:55:53 +0000 (04:55 +0300)
Lib/test/test_calendar.py

index 8adf5bd14bc0ccad8ae89e08aa21ad89b20b845f..f680b52f09747b324914e2c9af677385fe12c641 100644 (file)
@@ -399,6 +399,27 @@ class OutputTestCase(unittest.TestCase):
             '<tr><th colspan="7" class="month">January</th></tr>'
         )
 
+    def test_prweek(self):
+        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")
+
+    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())
+
+    def test_pryear(self):
+        with support.captured_stdout() as out:
+            calendar.TextCalendar().pryear(2004)
+            self.assertEqual(out.getvalue().strip(), result_2004_text.strip())
+
+    def test_format(self):
+        with support.captured_stdout() as out:
+            calendar.format(["1", "2", "3"], colwidth=3, spacing=1)
+            self.assertEqual(out.getvalue().strip(), "1   2   3")
 
 class CalendarTestCase(unittest.TestCase):
     def test_isleap(self):