summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2009-02-16 01:43:51 +0000
committerBob Ippolito <bob@redivi.com>2009-02-16 01:43:51 +0000
commitf909e2fb180a63dccb8311b28ec8ea5db34c9466 (patch)
tree227f3adb0f9f9f404f0aeeb128a524f4513ee717
parent3f349017d97fb9143fa55393d15540c547fe9411 (diff)
downloadsimplejson-f909e2fb180a63dccb8311b28ec8ea5db34c9466.tar.gz
whitespace
git-svn-id: http://simplejson.googlecode.com/svn/trunk@167 a4795897-2c25-0410-b006-0d3caba88fa1
-rw-r--r--simplejson/__init__.py2
-rw-r--r--simplejson/tests/test_recursion.py2
-rw-r--r--simplejson/tests/test_scanstring.py7
-rw-r--r--simplejson/tool.py8
4 files changed, 16 insertions, 3 deletions
diff --git a/simplejson/__init__.py b/simplejson/__init__.py
index 099f256..8b4f458 100644
--- a/simplejson/__init__.py
+++ b/simplejson/__init__.py
@@ -103,6 +103,8 @@ __all__ = [
'JSONDecoder', 'JSONEncoder',
]
+__author__ = 'Bob Ippolito <bob@redivi.com>'
+
from decoder import JSONDecoder
from encoder import JSONEncoder
diff --git a/simplejson/tests/test_recursion.py b/simplejson/tests/test_recursion.py
index 54b0193..97422a6 100644
--- a/simplejson/tests/test_recursion.py
+++ b/simplejson/tests/test_recursion.py
@@ -5,6 +5,7 @@ import simplejson as json
class JSONTestObject:
pass
+
class RecursiveJSONEncoder(json.JSONEncoder):
recurse = False
def default(self, o):
@@ -15,6 +16,7 @@ class RecursiveJSONEncoder(json.JSONEncoder):
return 'JSONTestObject'
return json.JSONEncoder.default(o)
+
class TestRecursion(TestCase):
def test_listrecursion(self):
x = []
diff --git a/simplejson/tests/test_scanstring.py b/simplejson/tests/test_scanstring.py
index fec8cf2..b08dec7 100644
--- a/simplejson/tests/test_scanstring.py
+++ b/simplejson/tests/test_scanstring.py
@@ -2,6 +2,7 @@ import sys
import decimal
from unittest import TestCase
+import simplejson as json
import simplejson.decoder
class TestScanString(TestCase):
@@ -102,3 +103,9 @@ class TestScanString(TestCase):
self.assertEquals(
scanstring('["Bad value", truth]', 2, None, True),
(u'Bad value', 12))
+
+ def test_issue3623(self):
+ self.assertRaises(ValueError, json.decoder.scanstring, "xxx", 1,
+ "xxx")
+ self.assertRaises(UnicodeDecodeError,
+ json.encoder.encode_basestring_ascii, "xx\xff")
diff --git a/simplejson/tool.py b/simplejson/tool.py
index d918a51..0ba20bb 100644
--- a/simplejson/tool.py
+++ b/simplejson/tool.py
@@ -1,5 +1,6 @@
-r"""Using simplejson from the shell to validate and
-pretty-print::
+r"""Command-line tool to validate and pretty-print JSON
+
+Usage::
$ echo '{"json":"obj"}' | python -m simplejson.tool
{
@@ -7,11 +8,12 @@ pretty-print::
}
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
+
"""
+import sys
import simplejson
def main():
- import sys
if len(sys.argv) == 1:
infile = sys.stdin
outfile = sys.stdout