diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2020-08-22 10:38:17 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2020-08-22 10:38:17 +0200 |
commit | cb6940a2c467335813172a402a04cbfdb9b3b6de (patch) | |
tree | 96728dc97a70e54303ff3c5bbd474b55fb6a0574 | |
parent | 5e5d95418a155a23322148b8935848b6f89d59f1 (diff) | |
download | lulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.tar.gz lulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.tar.bz2 lulua-cb6940a2c467335813172a402a04cbfdb9b3b6de.zip |
Add test for HTMLSerializer
-rw-r--r-- | lulua/test_text.py | 14 |
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 & World!</p> +</body></html>""")) + walker = html5lib.getTreeWalker("etree") + stream = walker (document) + s = HTMLSerializer() + assert ''.join (s.serialize(stream)) == ' Hello & World!\n\n ' + |