1. ms2ger
  2. Anolis

Commits

ms2ger  committed 1bc8a32

Don't cononicalize the output in tests.

  • Participants
  • Parent commits 510afda
  • Branches default

Comments (0)

Files changed (32)

File runtests.py

View file
  • Ignore whitespace
     for file_name in get_files("tests", "*", "*.src.html"):
 
         def testFunc(self, file_name=file_name):
+            assert file_name.endswith(".src.html")
+            base_path = file_name[:-len(".src.html")]
             try:
                 output = StringIO.StringIO()
-                expected = StringIO.StringIO()
 
                 if file_name.startswith(os.path.join("tests", "refs")):
                     processes = ["filter", "sub", "toc", "xref", "annotate", "refs"]
                 input.close()
                 
                 # Get the output
-                tree.write_c14n(output)
+                generator.toFile(tree, output)
 
                 # Get the expected result
-                expectedfp = open(file_name[:-9] + ".html", "rb")
-                builder = treebuilders.getTreeBuilder("lxml", etree)
-                try:
-                    parser = html5lib.HTMLParser(tree=builder, namespaceHTMLElements=False)
-                except TypeError:
-                    parser = html5lib.HTMLParser(tree=builder)
-                expectedTree = parser.parse(expectedfp)
+                expectedfp = open(base_path + ".html", "rb")
+                expected = expectedfp.read()
                 expectedfp.close()
-                expectedTree.write_c14n(expected)
 
                 # Run the test
-                self.assertEquals(output.getvalue(), expected.getvalue())
+                self.assertEquals(output.getvalue(), expected)
             except IOError as err:
                 self.fail(err)
 

File tests/basic/dfn-data-anolis-xref.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn data-anolis-xref=foo id=foobar>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn data-anolis-xref=foo id=foobar>foobar</dfn></p>
 <p><a href=#foobar>foo</a></p>

File tests/basic/dfn-in-header.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1 id=the-foobar-magic>The <dfn>foobar</dfn> magic</h1>
+<!DOCTYPE html><meta charset=utf-8><h1 id=the-foobar-magic>The <dfn>foobar</dfn> magic</h1>
 <p><a href=#the-foobar-magic>foobar</a></p>

File tests/basic/dfn_data-anolis-xref_multiple.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn data-anolis-xref=foo|bar id=foobar>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn data-anolis-xref=foo|bar id=foobar>foobar</dfn></p>
 <p><a href=#foobar>foo</a></p>
 <p><a href=#foobar>foo</a></p>

File tests/basic/dfn_nested_content.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foobar><span>foobar</span></dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foobar><span>foobar</span></dfn></p>
 <p><a href=#foobar>foobar</a></p>

File tests/basic/dfn_predefined_id.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foo>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foo>foobar</dfn></p>
 <p><a href=#foo>foobar</a></p>

File tests/basic/dfn_title.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foo title=foo>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foo title=foo>foobar</dfn></p>
 <p><a href=#foo>foo</a></p>

File tests/basic/dfn_title_multiple.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foo-bar title=foo|bar>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foo-bar title=foo|bar>foobar</dfn></p>
 <p><a href=#foo-bar>foo</a></p>
 <p><a href=#foo-bar>foo</a></p>

File tests/basic/dfn_whitespace.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foo-bar>foo
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foo-bar>foo
 bar</dfn></p>
 <p><a href=#foo-bar>foo bar</a></p>

File tests/basic/html5-id-hypen.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <h2 id=generatedID><span class=secno>1 </span>-</h2>

File tests/basic/multi-num-pre-existing.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <h2 id=bar><span class=secno>1 </span>Bar</h2>

File tests/basic/num-pre-existing.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <h2 id=bar><span class=secno>1 </span>Bar</h2>

File tests/basic/num-within-em.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <h2 id=bar><span class=secno>1 </span><em>Bar</em></h2>

File tests/basic/toc-basic.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>
  <li><a href=#bar><span class=secno>1 </span>Bar</a></li>
- <li><a href=#baz><span class=secno>2 </span>Baz?</a></li></ol>
+ <li><a href=#baz><span class=secno>2 </span>Baz?</a></ol>
 <!--end-toc-->
 <h2 id=bar><span class=secno>1 </span>Bar</h2>
 <h2 id=baz><span class=secno>2 </span>Baz?</h2>

File tests/basic/toc-begin-end-content-garbage.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <!--begin-toc-->
 <ol class=toc>
  <li><a href=#bar><span class=secno>1 </span>Bar</a></ol><!--end-toc-->

File tests/basic/toc-begin-end-content.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <!--begin-toc-->
 <ol class=toc>
  <li><a href=#bar><span class=secno>1 </span>Bar</a></ol><!--end-toc-->

File tests/basic/toc-begin-end.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 <!--begin-toc-->
 <ol class=toc>
  <li><a href=#bar><span class=secno>1 </span>Bar</a></ol><!--end-toc-->

File tests/basic/toc-code.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-dfn-code.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-dfn-within-em.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-dfn.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-header-element-descendant-h1.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-header-element-h2.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-header-element.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-multi-a.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-multi-dfn-children.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-nested-dfn.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-remove-a.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc>

File tests/basic/toc-tail.html

View file
  • Ignore whitespace
-<!DOCTYPE html><h1>Foo</h1>
+<!DOCTYPE html><meta charset=utf-8><h1>Foo</h1>
 
 <!--begin-toc-->
 <ol class=toc></ol>

File tests/basic/xref-nested.html

View file
  • Ignore whitespace
-<!DOCTYPE html><p><dfn id=foobar>foobar</dfn></p>
+<!DOCTYPE html><meta charset=utf-8><p><dfn id=foobar>foobar</dfn></p>
 <p><dfn id=lol>lol</dfn></p>
 <p><a href=#foobar><code>foo<span title="">bar</span></code></a></p>
 <p><a href=#lol>lol</a></p>

File tests/refs/isbn.html

View file
  • Ignore whitespace
-<!DOCTYPE html><html><head></head><body><a href=#refsTIS620>[TIS620]</a>
+<!DOCTYPE html><meta charset=utf-8><a href=#refsTIS620>[TIS620]</a>
 <div id=anolis-references>
 <dl><dt id=refsTIS620>[TIS620]
-</dt><dd><cite><a href=http://www.nectec.or.th/it-standards/std620/std620.htm>UDC 681.3.04:003.62</a></cite>. Thai Industrial Standards Institute, Ministry of Industry, Royal Thai Government. ISBN 974-606-153-4.
+<dd><cite><a href=http://www.nectec.or.th/it-standards/std620/std620.htm>UDC 681.3.04:003.62</a></cite>. Thai Industrial Standards Institute, Ministry of Industry, Royal Thai Government. ISBN 974-606-153-4.
 
-</dd></dl></div></body></html>
+</dl></div>