diff options
author | Bob Ippolito <bob@redivi.com> | 2013-02-21 15:21:33 -0800 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2013-02-21 15:21:33 -0800 |
commit | 68aea11176fc7e3f376482dbddccd252836c1b85 (patch) | |
tree | c5c266202a7d09b4c40b16b73b9b630bafd26db2 | |
parent | db53d9a525ea7fec93a00fc17a1e094e821961ad (diff) | |
download | simplejson-68aea11176fc7e3f376482dbddccd252836c1b85.tar.gz |
update JSON conformance test suite (#58)
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | simplejson/tests/test_fail.py | 24 | ||||
-rw-r--r-- | simplejson/tests/test_pass1.py | 19 |
3 files changed, 30 insertions, 15 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 04e22c9..826cb66 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ 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 diff --git a/simplejson/tests/test_fail.py b/simplejson/tests/test_fail.py index d882ec0..788f3a5 100644 --- a/simplejson/tests/test_fail.py +++ b/simplejson/tests/test_fail.py @@ -3,14 +3,14 @@ from unittest import TestCase import simplejson as json -# Fri Dec 30 18:57:26 2005 +# 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 - '{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 @@ JSONDOCS = [ # 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 @@ JSONDOCS = [ '["Bad value", truth]', # http://json.org/JSON_checker/test/fail24.json "['single quote']", + # http://json.org/JSON_checker/test/fail25.json + '["\ttab\tcharacter\tin\tstring\t"]', + # http://json.org/JSON_checker/test/fail26.json + '["tab\\ character\\ in\\ string\\ "]', + # http://json.org/JSON_checker/test/fail27.json + '["line\nbreak"]', + # http://json.org/JSON_checker/test/fail28.json + '["line\\\nbreak"]', + # 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\u001FZ control characters in string"]', # misc based on coverage diff --git a/simplejson/tests/test_pass1.py b/simplejson/tests/test_pass1.py index b5e0588..f0b5b10 100644 --- a/simplejson/tests/test_pass1.py +++ b/simplejson/tests/test_pass1.py @@ -18,7 +18,7 @@ JSON = r''' "real": -9876.543210, "e": 0.123456789e-12, "E": 1.234567890E+34, - "": 23456789012E666, + "": 23456789012E66, "zero": 0, "one": 1, "space": " ", @@ -44,8 +44,7 @@ JSON = r''' , -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 @@ JSON = r''' 99.44 , -1066 - - +1066, +1e1, +0.1e1, +1e-1, +1e00,2e+00,2e-00 ,"rosebud"] ''' @@ -68,9 +69,3 @@ class TestPass1(TestCase): 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") |