Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,11 @@ def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
content = self.formatyear(theyear, width)
return self._format_html_page(theyear, content, css, encoding)

def formatmonthpage(self, theyear, themonth, width=3, css='calendar.css', encoding=None):
def formatmonthpage(self, theyear, themonth, css='calendar.css', encoding=None):
"""
Return a formatted month as a complete HTML page.
"""
content = self.formatmonth(theyear, themonth, width)
content = self.formatmonth(theyear, themonth)
return self._format_html_page(theyear, content, css, encoding)


Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ def test_format_html_year_with_month(self):
result_2009_6_html
)

def test_formatmonthpage_no_width(self):
# gh-140212: formatmonthpage must not accept a 'width' argument.
cal = calendar.HTMLCalendar()
self.assertIn(b'class="month">June 2009', cal.formatmonthpage(2009, 6))
self.assertRaises(TypeError, cal.formatmonthpage, 2009, 6, width=3)


class CalendarTestCase(unittest.TestCase):

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove the erroneous *width* argument of
:meth:`!calendar.HTMLCalendar.formatmonthpage`, which could drop the year from
the heading.
Loading