def test_para_with_mixture_of_types(self): img = Img("picture.png") ahref = Link("http://example.com") p = Para("Beautiful picture:", img, "See more at", ahref) self.assertEqual( p.html(), "<p>Beautiful picture: " "<img src='picture.png' /> " "See more at " "<a href='http://example.com'>" "http://example.com</a></p>")
def test_para(self): p = Para("some text") self.assertEqual(p.html(),"<p>some text</p>") p.add("that was added") self.assertEqual(p.html(),"<p>some text that was added</p>") p = Para("some text","that was added") self.assertEqual(p.html(),"<p>some text that was added</p>")
def test_para_non_zero(self): p = Para() self.assertFalse(p) p.add("some text") self.assertTrue(p)
def test_para_with_css_classes(self): p = Para("some text", css_classes=('cls1', 'cls2')) self.assertEqual(p.html(), "<p class='cls1 cls2'>some text</p>") p.add_css_classes("cls3", "cls4") self.assertEqual(p.html(), "<p class='cls1 cls2 cls3 cls4'>some text</p>")
def test_empty_para(self): p = Para() self.assertEqual(p.html(), "")