@@ 8,19 8,19 @@ from pml import HTML, XHTML, XML
class TestCase(unittest.TestCase):
def test_empty_tag(self):
'generation of an empty HTML tag'
- self.assertEquals(str(HTML().br), '<br>')
+ self.assertEqual(str(HTML().br), '<br>')
def test_empty_tag_xml(self):
'generation of an empty XHTML tag'
- self.assertEquals(str(XHTML().br), '<br />')
+ self.assertEqual(str(XHTML().br), '<br />')
def test_tag_add(self):
'test top-level tag creation'
- self.assertEquals(str(HTML('html', 'text')), '<html>\ntext\n</html>')
+ self.assertEqual(str(HTML('html', 'text')), '<html>\ntext\n</html>')
def test_tag_add_no_newline(self):
'test top-level tag creation'
- self.assertEquals(str(HTML('html', 'text', newlines=False)),
+ self.assertEqual(str(HTML('html', 'text', newlines=False)),
'<html>text</html>')
def test_iadd_tag(self):
@@ 28,7 28,7 @@ class TestCase(unittest.TestCase):
h = XML('xml')
h += XML('some-tag', 'spam', newlines=False)
h += XML('text', 'spam', newlines=False)
- self.assertEquals(str(h),
+ self.assertEqual(str(h),
'<xml>\n<some-tag>spam</some-tag>\n<text>spam</text>\n</xml>')
def test_iadd_text(self):
@@ 36,56 36,56 @@ class TestCase(unittest.TestCase):
h = HTML('html', newlines=False)
h += 'text'
h += 'text'
- self.assertEquals(str(h), '<html>texttext</html>')
+ self.assertEqual(str(h), '<html>texttext</html>')
def test_xhtml_match_tag(self):
'check forced generation of matching tag when empty'
- self.assertEquals(str(XHTML().p), '<p></p>')
+ self.assertEqual(str(XHTML().p), '<p></p>')
if sys.version_info[0] == 2:
def test_empty_tag_unicode(self):
'generation of an empty HTML tag'
- self.assertEquals(unicode(HTML().br), unicode('<br>'))
+ self.assertEqual(unicode(HTML().br), unicode('<br>'))
def test_empty_tag_xml_unicode(self):
'generation of an empty XHTML tag'
- self.assertEquals(unicode(XHTML().br), unicode('<br />'))
+ self.assertEqual(unicode(XHTML().br), unicode('<br />'))
def test_xhtml_match_tag_unicode(self):
'check forced generation of matching tag when empty'
- self.assertEquals(unicode(XHTML().p), unicode('<p></p>'))
+ self.assertEqual(unicode(XHTML().p), unicode('<p></p>'))
def test_just_tag(self):
'generate HTML for just one tag'
- self.assertEquals(str(HTML().br), '<br>')
+ self.assertEqual(str(HTML().br), '<br>')
def test_just_tag_xhtml(self):
'generate XHTML for just one tag'
- self.assertEquals(str(XHTML().br), '<br />')
+ self.assertEqual(str(XHTML().br), '<br />')
def test_xml(self):
'generate XML'
- self.assertEquals(str(XML().br), '<br />')
- self.assertEquals(str(XML().p), '<p />')
- self.assertEquals(str(XML().br('text')), '<br>text</br>')
+ self.assertEqual(str(XML().br), '<br />')
+ self.assertEqual(str(XML().p), '<p />')
+ self.assertEqual(str(XML().br('text')), '<br>text</br>')
def test_para_tag(self):
'generation of a tag with contents'
h = HTML()
h.p('hello')
- self.assertEquals(str(h), '<p>hello</p>')
+ self.assertEqual(str(h), '<p>hello</p>')
def test_escape(self):
'escaping of special HTML characters in text'
h = HTML()
h.text('<>&')
- self.assertEquals(str(h), '<>&')
+ self.assertEqual(str(h), '<>&')
def test_no_escape(self):
'no escaping of special HTML characters in text'
h = HTML()
h.text('<>&', False)
- self.assertEquals(str(h), '<>&')
+ self.assertEqual(str(h), '<>&')
with h.p('hello', escape=False) as p:
p.a('world', href='http://perdu.com')
@@ 94,7 94,7 @@ class TestCase(unittest.TestCase):
'escaping of special HTML characters in attributes'
h = HTML()
h.br(id='<>&"')
- self.assertEquals(str(h), '<br id="<>&"">')
+ self.assertEqual(str(h), '<br id="<>&"">')
def test_subtag_context(self):
'generation of sub-tags using "with" context'
@@ 102,7 102,7 @@ class TestCase(unittest.TestCase):
with h.ol:
h.li('foo')
h.li('bar')
- self.assertEquals(str(h), '<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>')
+ self.assertEqual(str(h), '<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>')
def test_subtag_direct(self):
'generation of sub-tags directly on the parent tag'
@@ 110,7 110,7 @@ class TestCase(unittest.TestCase):
l = h.ol
l.li('foo')
l.li.b('bar')
- self.assertEquals(str(h),
+ self.assertEqual(str(h),
'<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>')
def test_subtag_direct_context(self):
@@ 119,7 119,7 @@ class TestCase(unittest.TestCase):
with h.ol as l:
l.li('foo')
l.li.b('bar')
- self.assertEquals(str(h),
+ self.assertEqual(str(h),
'<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>')
def test_subtag_no_newlines(self):
@@ 128,35 128,35 @@ class TestCase(unittest.TestCase):
l = h.ol(newlines=False)
l.li('foo')
l.li('bar')
- self.assertEquals(str(h), '<ol><li>foo</li><li>bar</li></ol>')
+ self.assertEqual(str(h), '<ol><li>foo</li><li>bar</li></ol>')
def test_add_text(self):
'add text to a tag'
h = HTML()
p = h.p('hello, world!\n')
p.text('more text')
- self.assertEquals(str(h), '<p>hello, world!\nmore text</p>')
+ self.assertEqual(str(h), '<p>hello, world!\nmore text</p>')
def test_add_text_newlines(self):
'add text to a tag with newlines for prettiness'
h = HTML()
p = h.p('hello, world!', newlines=True)
p.text('more text')
- self.assertEquals(str(h), '<p>\nhello, world!\nmore text\n</p>')
+ self.assertEqual(str(h), '<p>\nhello, world!\nmore text\n</p>')
def test_doc_newlines(self):
'default document adding newlines between tags'
h = HTML()
h.br
h.br
- self.assertEquals(str(h), '<br>\n<br>')
+ self.assertEqual(str(h), '<br>\n<br>')
def test_doc_no_newlines(self):
'prevent document adding newlines between tags'
h = HTML(newlines=False)
h.br
h.br
- self.assertEquals(str(h), '<br><br>')
+ self.assertEqual(str(h), '<br><br>')
def test_unicode(self):
'make sure unicode input works and results in unicode output'
@@ 169,7 169,7 @@ class TestCase(unittest.TestCase):
unicode = str
TEST = 'euro €'
h.p(TEST)
- self.assertEquals(unicode(h), '<p>%s</p>' % TEST)
+ self.assertEqual(unicode(h), '<p>%s</p>' % TEST)
def test_table(self):
'multiple "with" context blocks'
@@ 179,7 179,7 @@ class TestCase(unittest.TestCase):
with h.tr:
h.td('column 1')
h.td('column 2')
- self.assertEquals(str(h), '''<table border="1">
+ self.assertEqual(str(h), '''<table border="1">
<tr><td>column 1</td><td>column 2</td></tr>
<tr><td>column 1</td><td>column 2</td></tr>
</table>''')