Skip to content

Commit 5711c88

Browse files
author
James Graham
committed
Use json instead of simplejson where possible
1 parent 7d9166a commit 5711c88

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

html5lib/tests/support.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
del base_path
2121

22-
import simplejson
23-
2422
#Build a dict of avaliable trees
2523
treeTypes = {"simpletree":treebuilders.getTreeBuilder("simpletree"),
2624
"DOM":treebuilders.getTreeBuilder("dom")}

html5lib/tests/test_tokenizer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import warnings
66
import re
77

8-
from support import simplejson, html5lib_test_files
8+
try:
9+
import json
10+
except ImportError:
11+
import simplejson as json
912

13+
from support import html5lib_test_files
1014
from html5lib.tokenizer import HTMLTokenizer
1115
from html5lib import constants
1216

@@ -82,7 +86,7 @@ def normalizeTokens(tokens):
8286
for i, token in enumerate(tokens):
8387
if token[0] == u'ParseError':
8488
tokens[i] = token[0]
85-
return simplejson.loads(simplejson.dumps(tokens))
89+
return json.loads(json.dumps(tokens))
8690

8791
def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder):
8892
"""Test whether the test has passed or failed
@@ -158,7 +162,7 @@ def capitalize(s):
158162
def buildTestSuite():
159163
for filename in html5lib_test_files('tokenizer', '*.test'):
160164
print filename
161-
tests = simplejson.load(file(filename))
165+
tests = json.load(file(filename))
162166
testName = os.path.basename(filename).replace(".test","")
163167
if 'tests' in tests:
164168
for index,test in enumerate(tests['tests']):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy