# page.append("And here is another piece of text -- you should be able to add any number") # render_page(page, "test_html_output1.html") # The rest of the steps have been commented out. # Uncomment them as you move along with the assignment. # ## Step 2 # ########## page = hr.Html() body = hr.Body() 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")) body.append( hr. P("And here is another piece of text -- you should be able to add any number" )) page.append(body) render_page(page, "test_html_output2.html") # # Step 3 # ########## # page = hr.Html()
def test_Meta_130(self): # Can't append an element self.e2 = hr.P("\n Nothing. \t\t") self.e1 = hr.Meta() with self.assertRaises(TypeError): self.e1.append(self.e2)
# page.append("And here is another piece of text -- you should be able to add any number") # render_page(page, "test_html_output1.html") # The rest of the steps have been commented out. # Uncomment them as you move along with the assignment. # ## Step 2 # ########## page = hr.Html() # print(page) body = hr.Body() # print(body) 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")) # print(body.content) body.append(hr.P("And here is another piece of text -- you should be able to add any number")) # print(body.content) page.append(body) render_page(page, "test_html_output2.html") # # Step 3 # ########## # page = hr.Html() # head = hr.Head() # head.append(hr.Title("PythonClass = Revision 1087:"))
def test_P_element_2(self): self.e1 = hr.P(consts.strs_before[0]) for string in consts.strs_before[1:]: self.e1.append(string) self.assertEqual(self.e1.contents, list(consts.strs_after))
def test_H_073(self): # Can't specify an element as a heading child with self.assertRaises(TypeError): self.e2 = hr.P("A paragraph.") self.e1 = hr.H(1, self.e2)
def test_p(): e = hr.P("text for paragraph tag")
def test_P_element_1(self): self.e1 = hr.P() self.e1.append(consts.strs_before) self.assertEqual(self.e1.contents, list(consts.strs_after))
def test_p(): e = hr.P("this") text = render_me(e).strip() assert text.startswith("<p>") assert text.endswith("</p>") assert "this" in text
def setUp(self): self.test = hr.P(style="text-align: center; font-style: oblique;")
def test_element_init_w_clas_attribute(): page = hr.P("some content", clas="intro") f = StringIO() page.render(f) expected = '<p class="intro">\n some content\n</p>\n' assert f.getvalue() == expected
page = hr.Html() head = hr.Head() #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)
def test_p(): e = hr.P() assert e.tag == "p"
# ######## page = hr.Html() head = hr.Head() head.append( hr.Meta(charset=u"UTF-8") ) head.append(hr.Title(u"PythonClass = Revision 1087:")) page.append(head) body = hr.Body() body.append( hr.H(2, u"PythonClass - Class 6 example") ) body.append(hr.P(u"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=u"text-align: center; font-style: oblique;")) body.append(hr.Hr()) list = hr.Ul(id=u"TheList", style=u"line-height:200%") list.append( hr.Li(u"The first item in a list") ) list.append( hr.Li(u"This is the second item", style="color: red") ) item = hr.Li() item.append(u"And this is a ") item.append( hr.A(u"http://google.com", "link") ) item.append(u"to google") list.append(item)
def test_p(): e = hr.P("Test", **{"t1": "t2"}) f = StringIO() e.render(f) assert (f.getvalue() == "<p t1=\"t2\">\n Test\n</p>")
page.append("And here is another piece of text -- you should be able to add any number") render_page(page, "test_html_output1.html") # The rest of the steps have been commented out. # Uncomment them as you move along with the assignment. ## Step 2 ########## page = hr.Html() body = hr.Body() 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")) body.append(hr.P("And here is another piece of text -- you should be able to add any number")) page.append(body) render_page(page, "test_html_output2.html") # Step 3 ########## page = hr.Html() head = hr.Head() head.append(hr.Title("PythonClass = Revision 1087:"))
) render_page(page, "test_html_output1.html") # The rest of the steps have been commented out. # Uncomment them as you move along with the assignment. # ## Step 2 # ########## page = hr.Html() body = hr.Body() 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")) body.append( hr. P("And here is another piece of text -- you should be able to add any number" )) page.append(body) render_page(page, "test_html_output2.html") # # Step 3 # ########## page = hr.Html()
) render_page(page, "test_html_output1.html") # The rest of the steps have been commented out. # Uncomment them as you move along with the assignment. ## Step 2 ########## page = hr.Html() body = hr.Body() 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")) body.append( hr. P("And here is another piece of text -- you should be able to add any number" )) page.append(body) render_page(page, "test_html_output2.html") # Step 3 ########## page = hr.Html()
def test_keywords_type(self): with self.assertRaises(TypeError): self.tag = hr.P('Test html', keywords="id='tag_id'")