def test_icase_href(self): for x in ('HREF', 'Href', 'hreF', 'href'): self.assertEqual(R.html2vtml('<a %s="link.here">foo</a>' % x), self.a_format % 'foo (link.here)', x) self.assertEqual(R.html2vtml('<A %s="link.here">foo</a>' % x), self.a_format % 'foo (link.here)') self.assertEqual(R.html2vtml('<A %s="link.here">foo</A>' % x), self.a_format % 'foo (link.here)') self.assertEqual(R.html2vtml('<a %s="link.here">foo</A>' % x), self.a_format % 'foo (link.here)')
def test_unquoted_href(self): self.assertEqual(R.html2vtml('<a href=link.here>foo</a>'), self.a_format % 'foo (link.here)')
def test_quoted_href(self): self.assertEqual(R.html2vtml('<a href="link.here">foo</a>'), self.a_format % 'foo (link.here)') self.assertEqual(R.html2vtml("<a href='link.here'>foo</a>"), self.a_format % 'foo (link.here)')
def test_empty_href(self): self.assertEqual(R.html2vtml('<a href>foo</a>'), self.a_format % 'foo')
def test_a_tag_no_href(self): self.assertEqual(R.html2vtml('<a>foo</a>'), self.a_format % 'foo')
def test_strip(self): self.assertEqual(R.html2vtml('<script>nope</script>'), '') self.assertEqual(R.html2vtml('before<script>nope</script>after'), 'beforeafter')
def test_noop(self): self.assertEqual(R.html2vtml('<script>nope</script>'), '')
def test_parity(self): for tag in ('b', 'u'): markup = '<%s>stuff</%s>' % (tag, tag) self.assertEqual(R.html2vtml(markup), markup)