Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
simplejson
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
simplejson
Commits
6f3aec782117
Commit
6f3aec782117
authored
12 years ago
by
Bob Ippolito
Browse files
Options
Downloads
Patches
Plain Diff
update JSON conformance test suite (#58)
parent
02f006dbc070
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES.txt
+2
-0
2 additions, 0 deletions
CHANGES.txt
simplejson/tests/test_fail.py
+21
-3
21 additions, 3 deletions
simplejson/tests/test_fail.py
simplejson/tests/test_pass1.py
+7
-12
7 additions, 12 deletions
simplejson/tests/test_pass1.py
with
30 additions
and
15 deletions
CHANGES.txt
+
2
−
0
View file @
6f3aec78
Version 3.1.0 released XXXX-XX-XX
* Updated JSON conformance test suite
http://bugs.python.org/issue16559
* simplejson.tool tests and bugfix for Python 3.x
http://bugs.python.org/issue16549
* Improve error messages for certain kinds of truncated input
...
...
This diff is collapsed.
Click to expand it.
simplejson/tests/test_fail.py
+
21
−
3
View file @
6f3aec78
...
...
@@ -3,10 +3,10 @@
import
simplejson
as
json
#
Fri Dec 30 18:57:26 20
05
#
2007-10-
05
JSONDOCS
=
[
# http://json.org/JSON_checker/test/fail1.json
'"
A JSON payload should be an object or array, not a string.
"'
,
# http://json.org/JSON_checker/test/fail2.json
'
[
"
Unclosed array
"'
,
# http://json.org/JSON_checker/test/fail3.json
...
...
@@ -7,10 +7,10 @@
JSONDOCS
=
[
# http://json.org/JSON_checker/test/fail1.json
'"
A JSON payload should be an object or array, not a string.
"'
,
# http://json.org/JSON_checker/test/fail2.json
'
[
"
Unclosed array
"'
,
# http://json.org/JSON_checker/test/fail3.json
'
{unquoted_key:
"
keys must be quoted}
'
,
'
{unquoted_key:
"
keys must be quoted
"
}
'
,
# http://json.org/JSON_checker/test/fail4.json
'
[
"
extra comma
"
,]
'
,
# http://json.org/JSON_checker/test/fail5.json
...
...
@@ -36,7 +36,7 @@
# http://json.org/JSON_checker/test/fail15.json
'
[
"
Illegal backslash escape:
\\
x15
"
]
'
,
# http://json.org/JSON_checker/test/fail16.json
'
[
"
Illegal backslash escape:
\\\'
"
]
'
,
'
[
\\
naked
]
'
,
# http://json.org/JSON_checker/test/fail17.json
'
[
"
Illegal backslash escape:
\\
017
"
]
'
,
# http://json.org/JSON_checker/test/fail18.json
...
...
@@ -53,6 +53,24 @@
'
[
"
Bad value
"
, truth]
'
,
# http://json.org/JSON_checker/test/fail24.json
"
[
'
single quote
'
]
"
,
# http://json.org/JSON_checker/test/fail25.json
'
[
"
\t
tab
\t
character
\t
in
\t
string
\t
"
]
'
,
# http://json.org/JSON_checker/test/fail26.json
'
[
"
tab
\\
character
\\
in
\\
string
\\
"
]
'
,
# http://json.org/JSON_checker/test/fail27.json
'
[
"
line
\n
break
"
]
'
,
# http://json.org/JSON_checker/test/fail28.json
'
[
"
line
\\\n
break
"
]
'
,
# http://json.org/JSON_checker/test/fail29.json
'
[0e]
'
,
# http://json.org/JSON_checker/test/fail30.json
'
[0e+]
'
,
# http://json.org/JSON_checker/test/fail31.json
'
[0e+-1]
'
,
# http://json.org/JSON_checker/test/fail32.json
'
{
"
Comma instead if closing brace
"
: true,
'
,
# http://json.org/JSON_checker/test/fail33.json
'
[
"
mismatch
"
}
'
,
# http://code.google.com/p/simplejson/issues/detail?id=3
u
'
[
"
A
\u001F
Z control characters in string
"
]
'
,
# misc based on coverage
...
...
This diff is collapsed.
Click to expand it.
simplejson/tests/test_pass1.py
+
7
−
12
View file @
6f3aec78
...
...
@@ -18,7 +18,7 @@
"
real
"
: -9876.543210,
"
e
"
: 0.123456789e-12,
"
E
"
: 1.234567890E+34,
""
: 23456789012E66
6
,
""
: 23456789012E66,
"
zero
"
: 0,
"
one
"
: 1,
"
space
"
:
"
"
,
...
...
@@ -44,8 +44,7 @@
,
4 , 5 , 6 ,7 ],
"
compact
"
: [1,2,3,4,5,6,7],
4 , 5 , 6 ,7 ],
"
compact
"
: [1,2,3,4,5,6,7],
"
jsontext
"
:
"
{\"object with 1 member\":[\"array with 1 element\"]}
"
,
"
quotes
"
:
"
" \u0022 %22 0x22 034 "
"
,
"
\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:
'
,./<>?
"
...
...
@@ -56,9 +55,11 @@
99.44
,
1066
1066,
1e1,
0.1e1,
1e-1,
1e00,2e+00,2e-00
,
"
rosebud
"
]
'''
...
...
@@ -68,9 +69,3 @@
res
=
json
.
loads
(
JSON
)
out
=
json
.
dumps
(
res
)
self
.
assertEqual
(
res
,
json
.
loads
(
out
))
try
:
json
.
dumps
(
res
,
allow_nan
=
False
)
except
ValueError
:
pass
else
:
self
.
fail
(
"
23456789012E666 should be out of range
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment