@@ -21,14 +21,16 @@ class Xhtml5Test(unittest.TestCase):
21
21
22
22
def assertXmlEquals (self , input , expected = None , parser = XMLParser ):
23
23
document = parser (tree = dom .TreeBuilder ).parse (input ).documentElement
24
+ #print document.toxml('utf-8')
24
25
if not expected :
25
26
expected = xmlelem .sub (sortattrs , input )
26
27
expected = re .sub ('&#(\d+);' , ncr , expected )
27
28
output = xmlelem .sub (sortattrs , document .toxml ('utf-8' ))
28
29
self .assertEquals (expected , output )
29
30
else :
30
- self .assertEquals (expected , document .toxml ('utf-8' ))
31
-
31
+ self .assertEquals (expected , document .toxml ('utf-8' ))
32
+ pass
33
+
32
34
def assertXhtmlEquals (self , input , expected = None , parser = XHTMLParser ):
33
35
self .assertXmlEquals (input , expected , parser )
34
36
@@ -93,8 +95,7 @@ def test_malformed(self):
93
95
class XhtmlTest (Xhtml5Test ):
94
96
95
97
def test_mathml (self ):
96
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
97
- <head><title>MathML</title></head>
98
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>MathML</title></head>
98
99
<body>
99
100
<math xmlns="http://www.w3.org/1998/Math/MathML">
100
101
<mrow>
@@ -140,8 +141,7 @@ def test_mathml(self):
140
141
</body></html>""" )
141
142
142
143
def test_svg (self ):
143
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
144
- <head><title>SVG</title></head>
144
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>SVG</title></head>
145
145
<body>
146
146
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
147
147
<path d="M38,38c0-12,24-15,23-2c0,9-16,13-16,23v7h11v-4c0-9,17-12,17-27
@@ -154,8 +154,7 @@ def test_svg(self):
154
154
</body></html>""" )
155
155
156
156
def test_xlink (self ):
157
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
158
- <head><title>XLINK</title></head>
157
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>XLINK</title></head>
159
158
<body>
160
159
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
161
160
<defs xmlns:l="http://www.w3.org/1999/xlink">
@@ -180,22 +179,19 @@ def test_xlink(self):
180
179
</body></html>""" )
181
180
182
181
def test_br (self ):
183
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
184
- <head><title>BR</title></head>
182
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>BR</title></head>
185
183
<body>
186
184
<br/>
187
185
</body></html>""" )
188
186
189
187
def test_strong (self ):
190
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
191
- <head><title>STRONG</title></head>
188
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>STRONG</title></head>
192
189
<body>
193
190
<strong></strong>
194
191
</body></html>""" )
195
192
196
193
def test_script (self ):
197
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
198
- <head><title>SCRIPT</title></head>
194
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>SCRIPT</title></head>
199
195
<body>
200
196
<script>1 < 2 & 3</script>
201
197
</body></html>""" )
@@ -205,14 +201,12 @@ def test_script_src(self):
205
201
<head><title>SCRIPT</title><script src="http://example.com"/></head>
206
202
<body>
207
203
</body></html>""" ,
208
- """<html xmlns="http://www.w3.org/1999/xhtml">
209
- <head><title>SCRIPT</title><script src="http://example.com"></script></head>
204
+ """<html xmlns="http://www.w3.org/1999/xhtml"><head><title>SCRIPT</title><script src="http://example.com"></script></head>
210
205
<body>
211
206
</body></html>""" )
212
207
213
208
def test_title (self ):
214
- self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml">
215
- <head><title>1 < 2 & 3</title></head>
209
+ self .assertXhtmlEquals ("""<html xmlns="http://www.w3.org/1999/xhtml"><head><title>1 < 2 & 3</title></head>
216
210
<body>
217
211
</body></html>""" )
218
212
@@ -222,8 +216,7 @@ def test_prolog(self):
222
216
<head><title>PROLOG</title></head>
223
217
<body>
224
218
</body></html>""" ,
225
- """<html xmlns="http://www.w3.org/1999/xhtml">
226
- <head><title>PROLOG</title></head>
219
+ """<html xmlns="http://www.w3.org/1999/xhtml"><head><title>PROLOG</title></head>
227
220
<body>
228
221
</body></html>""" )
229
222
@@ -234,8 +227,7 @@ def test_tagsoup(self):
234
227
<body>
235
228
<u><blockquote><p></u>
236
229
</body></html>""" ,
237
- """<html xmlns="http://www.w3.org/1999/xhtml">
238
- <head><title>TAGSOUP</title></head>
230
+ """<html xmlns="http://www.w3.org/1999/xhtml"><head><title>TAGSOUP</title></head>
239
231
<body>
240
232
<u/><blockquote><u/><p><u/>
241
233
</p></blockquote></body></html>""" )
0 commit comments