pytidylib icon indicating copy to clipboard operation
pytidylib copied to clipboard

test_large_document fails with tidy-html5

Open brulzki opened this issue 5 years ago • 0 comments

I get the following failure when running tests with tidy-html5. There's no failures when running with the original tidy.

$ python tests/test_docs.py 
...F......
======================================================================
FAIL: test_large_document (__main__.TestDocs1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_docs.py", line 77, in test_large_document
    self.assertEqual(doc, expected)
AssertionError: '<!DO[72 chars]itle>\n    </title>\n  </head>\n  <body>\n    [10018 chars]l>\n' != '<!DO[72 chars]itle></title>\n  </head>\n  <body>\n    AAAAAA[10012 chars]l>\n'
Diff is 10191 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 10 tests in 0.034s

tidy-html5 version 5.6.0

It's not so obvious in the output above, but this is the only difference between the expected and the actual output:

--- exp.html    2019-12-03 21:07:07.011171997 +1000
+++ doc.html    2019-12-03 21:07:23.278212493 +1000
@@ -2,5 +2,6 @@
 <html>
   <head>
-    <title></title>
+    <title>
+    </title>
   </head>
   <body>

When the input string is up to 8063 characters, the title tags are not split across lines. At 8064 characters it starts splitting across lines.

It seems likely to be an error in tidy-html5, but I haven't been able to replicate the issue by using the command line tidy.

brulzki avatar Dec 03 '19 12:12 brulzki