我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用calendar.HTMLCalendar()。
def test_output_htmlcalendar(self): encoding = 'ascii' cal = calendar.HTMLCalendar() self.assertEqual( cal.formatyearpage(2004, encoding=encoding).strip(b' \t\n'), result_2004_html.strip(' \t\n').encode(encoding) )
def test_output_htmlcalendar(self): self.assertEqual( calendar.HTMLCalendar().formatyearpage(2004).strip(), result_2004_html.strip() )
def check_htmlcalendar_encoding(self, req, res): cal = calendar.HTMLCalendar() self.assertEqual( cal.formatyearpage(2004, encoding=req).strip(b' \t\n'), (result_2004_html % {'e': res}).strip(' \t\n').encode(res) )
def test_formatmonthname_with_year(self): self.assertEqual( calendar.HTMLCalendar().formatmonthname(2004, 1, withyear=True), '<tr><th colspan="7" class="month">January 2004</th></tr>' )
def test_formatmonthname_without_year(self): self.assertEqual( calendar.HTMLCalendar().formatmonthname(2004, 1, withyear=False), '<tr><th colspan="7" class="month">January</th></tr>' )
def index(): return template('<h1>Calendar | Calendario<hr> {{!data}}', data=HTMLCalendar().formatyearpage(2016))
def check_htmlcalendar_encoding(self, req, res): cal = calendar.HTMLCalendar() self.assertEqual( cal.formatyearpage(2004, encoding=req), (result_2004_html % {'e': res}).encode(res) )