@@ -79,9 +79,12 @@ def _convertAttrib(self, attribs):
79
79
80
80
def serialize_html (input , options ):
81
81
options = dict ([(str (k ), v ) for k , v in options .items ()])
82
+ encoding = options .get ("encoding" , None )
83
+ if "encoding" in options :
84
+ del options ["encoding" ]
82
85
stream = Lint (JsonWalker (input ), False )
83
86
serializer = HTMLSerializer (alphabetical_attributes = True , ** options )
84
- return serializer .render (stream , options . get ( " encoding" , None ) )
87
+ return serializer .render (stream , encoding )
85
88
86
89
87
90
def runSerializerTest (input , expected , options ):
@@ -146,6 +149,11 @@ def testComment():
146
149
throwsWithLatin1 ([["Comment" , "\u0101 " ]])
147
150
148
151
152
+ def testThrowsUnknownOption ():
153
+ with pytest .raises (TypeError ):
154
+ HTMLSerializer (foobar = None )
155
+
156
+
149
157
@pytest .mark .parametrize ("c" , list ("\t \n \u000C \x20 \r \" '=<>`" ))
150
158
def testSpecQuoteAttribute (c ):
151
159
input_ = [["StartTag" , "http://www.w3.org/1999/xhtml" , "span" ,
0 commit comments