def setUp(self): self.test = hr.Li(content=None)
body = hr.Body() body.append(hr.H(2, "PythonClass - Class 6 example")) body.append( hr.P( "Here is a paragraph of text -- there could be more of them, " "but this is enough to show that we can do some text", style="text-align: center; font-style: oblique;")) body.append(hr.Hr()) list = hr.Ul(id="TheList", style="line-height:200%") list.append(hr.Li("The first item in a list")) list.append(hr.Li("This is the second item", style="color: red")) item = hr.Li() item.append("And this is a ") item.append(hr.A("http://google.com", "link")) item.append("to google") list.append(item) body.append(list) page.append(body) render_page(page, "test_html_output7.html")
#head.append(hr.Meta(charset="UTF-8")) head.append(hr.Title("some stuff ex")) page.append(head) body = hr.Body() body.append(hr.H(2, "Python Class - Hmwk 6 ex")) body.append(hr.P("Here is a paragraph - keep reading!!", style="text-align: center, font-style: oblique;")) body.append(hr.Hr()) list = hr.U1(id="TheList", style="line-height:200%") list.append(hr.Li("the first item")) list.append(hr.Li("the second item", style="color: red")) item = hr.Li() item.append("And this is a ") item.append(hr.A("http://google.com", "link")) item.append("to google") list.append(item) body.append(list) page.append(body) render_page(page, "test_html_outpt.html")
def test_Li_single(self): li = hr.Li("Single item", style="color: green") self.assertEqual( self.rendercap(li), '<li style="color: green">\n Single item\n</li>\n')
def test_list(self): list = hr.Li("The first item in a list") f = StringIO() list.render(f) self.assertEqual(f.getvalue(), "<li>\n The first item in a list\n</li>\n")
body.append(hr.H(2, "PythonClass - Class 6 example")) body.append( hr.P( "Here is a paragraph of text -- there could be more of them, " "but this is enough to show that we can do some text", style="text-align: center; font-style: oblique;")) body.append(hr.Hr()) # list = hr.Ul(id="TheList", style="line-height:200%") # list.append( hr.Li("The first item in a list") ) # list.append( hr.Li("This is the second item", style="color: red") ) item = hr.Li() item.append("And this is a ") item.append(hr.A("http://google.com", "link")) item.append("to google") list.append(item) body.append(list) page.append(body) render_page(page, "test_html_output7.html") # # Step 8 and 9 # ##############
def test_li(): e = hr.Li("Test", **{"t1": "t2"}) f = StringIO() e.render(f) assert (f.getvalue() == "<li t1=\"t2\">\n Test\n</li>")
def test_ul(self): f = StringIO() self.ul = hr.Ul(hr.Li('some content')) self.ul.render(f, 0) self.assertEqual(f.getvalue(), '<ul>\n <li>some content</li>\n</ul>')
def test_li(self): f = StringIO() self.li = hr.Li('list element') self.li.render(f, 0) self.assertEqual(f.getvalue(), '<li>list element</li>')