Skip to content

Commit e378638

Browse files
committed
fixup! Placate pyflakes.
1 parent 8ad7e3b commit e378638

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

html5lib/treebuilders/etree.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,12 @@ def serializeElement(element, indent=0):
207207
rv.append("<!DOCTYPE %s>" % (element.text,))
208208
elif element.tag == "DOCUMENT_ROOT":
209209
rv.append("#document")
210-
assert element.text is None
211-
assert element.tail is None
210+
if element.text is not None:
211+
raise TypeError("Document node cannot have text")
212+
if element.tail is not None:
213+
raise TypeError("Document node cannot have tail")
214+
if hasattr(element, "attrib") and len(element.attrib):
215+
raise TypeError("Document node cannot have attributes")
212216
elif element.tag == ElementTreeCommentType:
213217
rv.append("|%s<!-- %s -->" % (' ' * indent, element.text))
214218
else:

0 commit comments

Comments
 (0)