summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2020-08-22 10:38:17 +0200
committerLars-Dominik Braun <lars@6xq.net>2020-08-22 10:38:17 +0200
commitcb6940a2c467335813172a402a04cbfdb9b3b6de (patch)
tree96728dc97a70e54303ff3c5bbd474b55fb6a0574
parent5e5d95418a155a23322148b8935848b6f89d59f1 (diff)
downloadlulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.tar.gz
lulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.tar.bz2
lulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.zip
Add test for HTMLSerializer
-rw-r--r--lulua/test_text.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/lulua/test_text.py b/lulua/test_text.py
index cd8ae7a..75673cb 100644
--- a/lulua/test_text.py
+++ b/lulua/test_text.py
@@ -19,9 +19,10 @@
# THE SOFTWARE.
import brotli
-from io import BytesIO
+from io import BytesIO, StringIO
+import html5lib
-from .text import charMap, mapChars, BrotliFile
+from .text import charMap, mapChars, BrotliFile, HTMLSerializer
def test_map_chars_mapped ():
""" Make sure all chars in the map are mapped correctly """
@@ -58,3 +59,12 @@ def test_brotlifile ():
s = f.read ()
assert s == b'ello world'
+def test_htmlserialized ():
+ document = html5lib.parse (StringIO ("""<html><body>
+<p>Hello &amp; World!</p>
+</body></html>"""))
+ walker = html5lib.getTreeWalker("etree")
+ stream = walker (document)
+ s = HTMLSerializer()
+ assert ''.join (s.serialize(stream)) == ' Hello & World!\n\n '
+