Skip to content

Commit 849e63d

Browse files
committed
Use the same version of JSON for serializer tests as tokenizer tests, and fix DOCTYPE output, and run all tests.
1 parent 1504ab0 commit 849e63d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

html5lib/tests/test_serializer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import os
22
import unittest
3-
from support import simplejson, html5lib_test_files
3+
from support import html5lib_test_files
4+
5+
try:
6+
import json
7+
except ImportError:
8+
import simplejson as json
49

510
import html5lib
611
from html5lib import html5parser, serializer, constants
@@ -117,7 +122,7 @@ def testEntityNoResolve(self):
117122
def buildBasicTestSuite():
118123
for filename in html5lib_test_files('serializer', '*.test'):
119124
test_name = os.path.basename(filename).replace('.test','')
120-
tests = simplejson.load(file(filename))
125+
tests = json.load(file(filename))
121126
for index, test in enumerate(tests['tests']):
122127
xhtml = test.get("xhtml", test["expected"])
123128
if test_name == 'optionaltags': xhtml = None

html5lib/tests/test_treewalkers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def convertTokens(tokens):
202202
token["publicId"],
203203
token["systemId"] and token["systemId"] or ""))
204204
elif token["systemId"]:
205-
output.append("""%s<!DOCTYPE %s SYSTEM "%s">"""%
205+
output.append("""%s<!DOCTYPE %s "" "%s">"""%
206206
(" "*indent, token["name"],
207207
token["systemId"]))
208208
else:
@@ -277,11 +277,8 @@ def buildTestSuite():
277277

278278
for treeName, treeCls in treeTypes.iteritems():
279279
files = html5lib_test_files('tree-construction')
280-
files = [f for f in files if
281-
not f.split(".")[-2][-2:] in ("s9", "10", "11", "12")] #skip namespace tests for now
282280
for filename in files:
283281
testName = os.path.basename(filename).replace(".dat","")
284-
if testName == "tests5": continue # TODO
285282

286283
tests = TestData(filename, "data")
287284

0 commit comments

Comments
 (0)