Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5711c88

Browse files
author
James Graham
committed
Use json instead of simplejson where possible
1 parent7d9166a commit5711c88

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
delbase_path
2121

22-
importsimplejson
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
importwarnings
66
importre
77

8-
fromsupportimportsimplejson,html5lib_test_files
8+
try:
9+
importjson
10+
exceptImportError:
11+
importsimplejsonasjson
912

13+
fromsupportimporthtml5lib_test_files
1014
fromhtml5lib.tokenizerimportHTMLTokenizer
1115
fromhtml5libimportconstants
1216

@@ -82,7 +86,7 @@ def normalizeTokens(tokens):
8286
fori,tokeninenumerate(tokens):
8387
iftoken[0]==u'ParseError':
8488
tokens[i]=token[0]
85-
returnsimplejson.loads(simplejson.dumps(tokens))
89+
returnjson.loads(json.dumps(tokens))
8690

8791
deftokensMatch(expectedTokens,receivedTokens,ignoreErrorOrder):
8892
"""Test whether the test has passed or failed
@@ -158,7 +162,7 @@ def capitalize(s):
158162
defbuildTestSuite():
159163
forfilenameinhtml5lib_test_files('tokenizer','*.test'):
160164
printfilename
161-
tests=simplejson.load(file(filename))
165+
tests=json.load(file(filename))
162166
testName=os.path.basename(filename).replace(".test","")
163167
if'tests'intests:
164168
forindex,testinenumerate(tests['tests']):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp