usenetbinary-newsreaderembyseedboxtvdbnzbgetsubtitlewebuiquickboxtraktkodistabletvshowsqnaptautullifanartsickbeardtvseriesplexswizzin
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
import support
|
|
from html5lib import html5parser
|
|
from html5lib.constants import namespaces
|
|
from html5lib.treebuilders import dom
|
|
|
|
import unittest
|
|
|
|
# tests that aren't autogenerated from text files
|
|
class MoreParserTests(unittest.TestCase):
|
|
|
|
def test_assertDoctypeCloneable(self):
|
|
parser = html5parser.HTMLParser(tree=dom.TreeBuilder)
|
|
doc = parser.parse('<!DOCTYPE HTML>')
|
|
self.assert_(doc.cloneNode(True))
|
|
|
|
def test_line_counter(self):
|
|
# http://groups.google.com/group/html5lib-discuss/browse_frm/thread/f4f00e4a2f26d5c0
|
|
parser = html5parser.HTMLParser(tree=dom.TreeBuilder)
|
|
parser.parse("<pre>\nx\n>\n</pre>")
|
|
|
|
def test_namespace_html_elements_0(self):
|
|
parser = html5parser.HTMLParser(namespaceHTMLElements=True)
|
|
doc = parser.parse("<html></html>")
|
|
self.assert_(doc.childNodes[0].namespace == namespaces["html"])
|
|
|
|
def test_namespace_html_elements_1(self):
|
|
parser = html5parser.HTMLParser(namespaceHTMLElements=False)
|
|
doc = parser.parse("<html></html>")
|
|
self.assert_(doc.childNodes[0].namespace == None)
|
|
|
|
def buildTestSuite():
|
|
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
|
|
|
def main():
|
|
buildTestSuite()
|
|
unittest.main()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|