Skip to content

Commit 5f27d93

Browse files
committed
Only try to roundtrip tests without parse errors.
1 parent 601fe17 commit 5f27d93

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

html5lib/tests/test_serializer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,17 @@ def runSerializerTest(input, expected, options):
109109
def runRoundtripTest(input, options):
110110
with warnings.catch_warnings():
111111
warnings.simplefilter("error")
112-
p = html5parser.HTMLParser()
113-
tree = p.parse(input)
112+
p = html5parser.HTMLParser(strict=True)
113+
try:
114+
tree = p.parse(input)
115+
except html5parser.ParseError:
116+
return
114117
try:
115118
serialized = html5lib.serialize(tree)
116119
except DataLossWarning:
117120
# Amnesty for those who confess
118121
return
122+
p = html5parser.HTMLParser()
119123
tree2 = p.parse(serialized)
120124
expected = p.tree.testSerializer(tree)
121125
output = p.tree.testSerializer(tree2)

0 commit comments

Comments
 (0)