From cb6940a2c467335813172a402a04cbfdb9b3b6de Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 22 Aug 2020 10:38:17 +0200 Subject: Add test for HTMLSerializer --- lulua/test_text.py | 14 ++++++++++++-- 1 file 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 (""" +

Hello & World!

+""")) + walker = html5lib.getTreeWalker("etree") + stream = walker (document) + s = HTMLSerializer() + assert ''.join (s.serialize(stream)) == ' Hello & World!\n\n ' + -- cgit v1.2.3