File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 5
5
import warnings
6
6
import re
7
7
8
- from support import simplejson , html5lib_test_files
8
+ try :
9
+ import json
10
+ except ImportError :
11
+ import simplejson as json
9
12
13
+ from support import html5lib_test_files
10
14
from html5lib .tokenizer import HTMLTokenizer
11
15
from html5lib import constants
12
16
@@ -82,7 +86,7 @@ def normalizeTokens(tokens):
82
86
for i , token in enumerate (tokens ):
83
87
if token [0 ] == u'ParseError' :
84
88
tokens [i ] = token [0 ]
85
- return simplejson .loads (simplejson .dumps (tokens ))
89
+ return json .loads (json .dumps (tokens ))
86
90
87
91
def tokensMatch (expectedTokens , receivedTokens , ignoreErrorOrder ):
88
92
"""Test whether the test has passed or failed
@@ -158,7 +162,7 @@ def capitalize(s):
158
162
def buildTestSuite ():
159
163
for filename in html5lib_test_files ('tokenizer' , '*.test' ):
160
164
print filename
161
- tests = simplejson .load (file (filename ))
165
+ tests = json .load (file (filename ))
162
166
testName = os .path .basename (filename ).replace (".test" ,"" )
163
167
if 'tests' in tests :
164
168
for index ,test in enumerate (tests ['tests' ]):
You can’t perform that action at this time.
0 commit comments