Hello community, here is the log from the commit of package python-simplejson for openSUSE:Factory checked in at Tue Mar 8 11:06:11 CET 2011. -------- --- python-simplejson/python-simplejson.changes 2010-09-16 10:23:53.000000000 +0200 +++ /mounts/work_src_done/STABLE/python-simplejson/python-simplejson.changes 2011-03-03 09:36:17.000000000 +0100 @@ -1,0 +2,13 @@ +Thu Mar 3 08:33:53 UTC 2011 - saschpe@suse.de + +- Update to 2.1.3 + * Support the sort_keys option in C encoding speedups + * Allow use_decimal to work with dump() + * Correct wrong end when object_pairs_hook is used + * Correct output for indent=0 + * Correctly raise TypeError when non-string keys are used with + speedups + * Fix the endlineno, endcolno attributes of the JSONDecodeError + exception. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- simplejson-2.1.1.tar.bz2 New: ---- simplejson-2.1.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-simplejson.spec ++++++ --- /var/tmp/diff_new_pack.DtSAB5/_old 2011-03-08 11:03:32.000000000 +0100 +++ /var/tmp/diff_new_pack.DtSAB5/_new 2011-03-08 11:03:32.000000000 +0100 @@ -1,7 +1,7 @@ # -# spec file for package python-simplejson (Version 2.1.1) +# spec file for package python-simplejson # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ Summary: Simple, fast, extensible JSON encoder/decoder for Python Name: python-simplejson -Version: 2.1.1 +Version: 2.1.3 Release: 1 License: BSD Url: http://undefined.org/python/#simplejson ++++++ simplejson-2.1.1.tar.bz2 -> simplejson-2.1.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/CHANGES.txt new/simplejson-2.1.3/CHANGES.txt --- old/simplejson-2.1.1/CHANGES.txt 2010-04-01 01:09:11.000000000 +0200 +++ new/simplejson-2.1.3/CHANGES.txt 2011-01-17 02:27:56.000000000 +0100 @@ -1,3 +1,21 @@ +Version 2.1.3 released 2011-01-17 + +* Support the sort_keys option in C encoding speedups + http://code.google.com/p/simplejson/issues/detail?id=86 +* Allow use_decimal to work with dump() + http://code.google.com/p/simplejson/issues/detail?id=87 + +Version 2.1.2 released 2010-11-01 + +* Correct wrong end when object_pairs_hook is used + http://code.google.com/p/simplejson/issues/detail?id=85 +* Correct output for indent=0 + http://bugs.python.org/issue10019 +* Correctly raise TypeError when non-string keys are used with speedups + http://code.google.com/p/simplejson/issues/detail?id=82 +* Fix the endlineno, endcolno attributes of the JSONDecodeError exception. + http://code.google.com/p/simplejson/issues/detail?id=81 + Version 2.1.1 released 2010-03-31 * Change how setup.py imports ez_setup.py to try and workaround old versions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/conf.py new/simplejson-2.1.3/conf.py --- old/simplejson-2.1.1/conf.py 2010-03-13 22:27:36.000000000 +0100 +++ new/simplejson-2.1.3/conf.py 2010-11-05 03:38:00.000000000 +0100 @@ -44,7 +44,7 @@ # The short X.Y version. version = '2.1' # The full version, including alpha/beta/rc tags. -release = '2.1.1' +release = '2.1.3' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/docs/genindex.html new/simplejson-2.1.3/docs/genindex.html --- old/simplejson-2.1.1/docs/genindex.html 2010-04-01 01:09:48.000000000 +0200 +++ new/simplejson-2.1.3/docs/genindex.html 2011-01-17 02:28:19.000000000 +0100 @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Index — simplejson v2.1.1 documentation</title> + <title>Index — simplejson v2.1.3 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', - VERSION: '2.1.1', + VERSION: '2.1.3', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html' }; @@ -19,7 +19,7 @@ <link rel="contents" title="Global table of contents" href="contents.html" /> <link rel="index" title="Global index" href="" /> <link rel="search" title="Search" href="search.html" /> - <link rel="top" title="simplejson v2.1.1 documentation" href="index.html" /> + <link rel="top" title="simplejson v2.1.3 documentation" href="index.html" /> </head> <body> <div class="related"> @@ -28,7 +28,7 @@ <li class="right" style="margin-right: 10px"> <a href="" title="General Index" accesskey="I">index</a></li> - <li><a href="index.html">simplejson v2.1.1 documentation</a> »</li> + <li><a href="index.html">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="document"> @@ -124,12 +124,12 @@ <li class="right" style="margin-right: 10px"> <a href="" title="General Index" accesskey="I">index</a></li> - <li><a href="index.html">simplejson v2.1.1 documentation</a> »</li> + <li><a href="index.html">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Bob Ippolito. - Last updated on Mar 31, 2010. + Last updated on Jan 17, 2011. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. </div> </body> Files old/simplejson-2.1.1/docs/._index.html and new/simplejson-2.1.3/docs/._index.html differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/docs/index.html new/simplejson-2.1.3/docs/index.html --- old/simplejson-2.1.1/docs/index.html 2010-04-01 01:09:48.000000000 +0200 +++ new/simplejson-2.1.3/docs/index.html 2011-01-17 02:28:19.000000000 +0100 @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>simplejson — JSON encoder and decoder — simplejson v2.1.1 documentation</title> + <title>simplejson — JSON encoder and decoder — simplejson v2.1.3 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', - VERSION: '2.1.1', + VERSION: '2.1.3', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html' }; @@ -19,7 +19,7 @@ <link rel="contents" title="Global table of contents" href="contents.html" /> <link rel="index" title="Global index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> - <link rel="top" title="simplejson v2.1.1 documentation" href="" /> + <link rel="top" title="simplejson v2.1.3 documentation" href="" /> </head> <body> <div class="related"> @@ -28,7 +28,7 @@ <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> - <li><a href="">simplejson v2.1.1 documentation</a> »</li> + <li><a href="">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="document"> @@ -552,12 +552,12 @@ <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> - <li><a href="">simplejson v2.1.1 documentation</a> »</li> + <li><a href="">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Bob Ippolito. - Last updated on Mar 31, 2010. + Last updated on Jan 17, 2011. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. </div> </body> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/docs/search.html new/simplejson-2.1.3/docs/search.html --- old/simplejson-2.1.1/docs/search.html 2010-04-01 01:09:48.000000000 +0200 +++ new/simplejson-2.1.3/docs/search.html 2011-01-17 02:28:19.000000000 +0100 @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Search — simplejson v2.1.1 documentation</title> + <title>Search — simplejson v2.1.3 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', - VERSION: '2.1.1', + VERSION: '2.1.3', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html' }; @@ -19,7 +19,7 @@ <link rel="contents" title="Global table of contents" href="contents.html" /> <link rel="index" title="Global index" href="genindex.html" /> <link rel="search" title="Search" href="" /> - <link rel="top" title="simplejson v2.1.1 documentation" href="index.html" /> + <link rel="top" title="simplejson v2.1.3 documentation" href="index.html" /> <script type="text/javascript" src="_static/searchtools.js"></script> </head> @@ -30,7 +30,7 @@ <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> - <li><a href="index.html">simplejson v2.1.1 documentation</a> »</li> + <li><a href="index.html">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="document"> @@ -69,12 +69,12 @@ <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> - <li><a href="index.html">simplejson v2.1.1 documentation</a> »</li> + <li><a href="index.html">simplejson v2.1.3 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Bob Ippolito. - Last updated on Mar 31, 2010. + Last updated on Jan 17, 2011. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. </div> </body> Files old/simplejson-2.1.1/._index.rst and new/simplejson-2.1.3/._index.rst differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/PKG-INFO new/simplejson-2.1.3/PKG-INFO --- old/simplejson-2.1.1/PKG-INFO 2010-04-01 01:11:17.000000000 +0200 +++ new/simplejson-2.1.3/PKG-INFO 2011-01-17 02:30:43.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: simplejson -Version: 2.1.1 +Version: 2.1.3 Summary: Simple, fast, extensible JSON encoder/decoder for Python Home-page: http://undefined.org/python/#simplejson Author: Bob Ippolito Files old/simplejson-2.1.1/scripts/._make_docs.py and new/simplejson-2.1.3/scripts/._make_docs.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/setup.py new/simplejson-2.1.3/setup.py --- old/simplejson-2.1.1/setup.py 2010-04-01 01:08:05.000000000 +0200 +++ new/simplejson-2.1.3/setup.py 2010-11-05 03:37:41.000000000 +0100 @@ -12,7 +12,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError -VERSION = '2.1.1' +VERSION = '2.1.3' DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python" LONG_DESCRIPTION = """ simplejson is a simple, fast, complete, correct and extensible Files old/simplejson-2.1.1/simplejson/._decoder.py and new/simplejson-2.1.3/simplejson/._decoder.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/decoder.py new/simplejson-2.1.3/simplejson/decoder.py --- old/simplejson-2.1.1/simplejson/decoder.py 2010-03-08 04:20:38.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/decoder.py 2010-11-01 10:30:05.000000000 +0100 @@ -31,7 +31,7 @@ class JSONDecodeError(ValueError): """Subclass of ValueError with the following additional properties: - + msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed @@ -40,7 +40,7 @@ colno: The column corresponding to pos endlineno: The line corresponding to end (may be None) endcolno: The column corresponding to end (may be None) - + """ def __init__(self, msg, doc, pos, end=None): ValueError.__init__(self, errmsg(msg, doc, pos, end=end)) @@ -50,7 +50,7 @@ self.end = end self.lineno, self.colno = linecol(doc, pos) if end is not None: - self.endlineno, self.endcolno = linecol(doc, pos) + self.endlineno, self.endcolno = linecol(doc, end) else: self.endlineno, self.endcolno = None, None @@ -197,7 +197,7 @@ if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) - return result, end + return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) Files old/simplejson-2.1.1/simplejson/._encoder.py and new/simplejson-2.1.3/simplejson/._encoder.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/encoder.py new/simplejson-2.1.3/simplejson/encoder.py --- old/simplejson-2.1.1/simplejson/encoder.py 2010-03-08 04:22:49.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/encoder.py 2010-11-05 03:39:15.000000000 +0100 @@ -147,7 +147,7 @@ If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. - + If use_decimal is true (not the default), ``decimal.Decimal`` will be supported directly by the encoder. For the inverse, decode JSON with ``parse_float=decimal.Decimal``. @@ -268,7 +268,7 @@ key_memo = {} if (_one_shot and c_make_encoder is not None - and not self.indent and not self.sort_keys): + and self.indent is None): _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/__init__.py new/simplejson-2.1.3/simplejson/__init__.py --- old/simplejson-2.1.1/simplejson/__init__.py 2010-03-13 22:27:36.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/__init__.py 2011-01-17 02:27:19.000000000 +0100 @@ -97,7 +97,7 @@ $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ -__version__ = '2.1.1' +__version__ = '2.1.3' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', @@ -191,7 +191,8 @@ if (not skipkeys and ensure_ascii and check_circular and allow_nan and cls is None and indent is None and separators is None and - encoding == 'utf-8' and default is None and not kw): + encoding == 'utf-8' and default is None and not use_decimal + and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: Files old/simplejson-2.1.1/simplejson/.___init__.py and new/simplejson-2.1.3/simplejson/.___init__.py differ Files old/simplejson-2.1.1/simplejson/._ordered_dict.py and new/simplejson-2.1.3/simplejson/._ordered_dict.py differ Files old/simplejson-2.1.1/simplejson/._scanner.py and new/simplejson-2.1.3/simplejson/._scanner.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/_speedups.c new/simplejson-2.1.3/simplejson/_speedups.c --- old/simplejson-2.1.1/simplejson/_speedups.c 2010-03-15 18:21:07.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/_speedups.c 2010-11-05 03:39:12.000000000 +0100 @@ -2185,9 +2185,9 @@ static PyObject *iteritems = NULL; PyObject *kstr = NULL; PyObject *ident = NULL; - PyObject *key, *value; PyObject *iter = NULL; PyObject *item = NULL; + PyObject *items = NULL; PyObject *encoded = NULL; int skipkeys; Py_ssize_t idx; @@ -2232,22 +2232,61 @@ */ } - /* TODO: C speedup not implemented for sort_keys */ + if (PyObject_IsTrue(s->sort_keys)) { + /* First sort the keys then replace them with (key, value) tuples. */ + Py_ssize_t i, nitems; + if (PyDict_CheckExact(dct)) + items = PyDict_Keys(dct); + else + items = PyMapping_Keys(dct); + if (items == NULL) + goto bail; + if (!PyList_Check(items)) { + PyErr_SetString(PyExc_ValueError, "keys must return list"); + goto bail; + } + if (PyList_Sort(items) < 0) + goto bail; + nitems = PyList_GET_SIZE(items); + for (i = 0; i < nitems; i++) { + PyObject *key, *value; + key = PyList_GET_ITEM(items, i); + value = PyDict_GetItem(dct, key); + item = PyTuple_Pack(2, key, value); + if (item == NULL) + goto bail; + PyList_SET_ITEM(items, i, item); + Py_DECREF(key); + } + } + else { + if (PyDict_CheckExact(dct)) + items = PyDict_Items(dct); + else + items = PyMapping_Items(dct); + } + if (items == NULL) + goto bail; + iter = PyObject_GetIter(items); + Py_DECREF(items); + if (iter == NULL) + goto bail; skipkeys = PyObject_IsTrue(s->skipkeys); idx = 0; - iter = PyObject_CallMethodObjArgs(dct, iteritems, NULL); - if (iter == NULL) - goto bail; while ((item = PyIter_Next(iter))) { - - key = PyTuple_GetItem(item, 0); + PyObject *encoded, *key, *value; + if (!PyTuple_Check(item) || Py_SIZE(item) != 2) { + PyErr_SetString(PyExc_ValueError, "items must return 2-tuples"); + goto bail; + } + key = PyTuple_GET_ITEM(item, 0); if (key == NULL) goto bail; - value = PyTuple_GetItem(item, 1); + value = PyTuple_GET_ITEM(item, 1); if (value == NULL) goto bail; - + encoded = PyDict_GetItem(s->key_memo, key); if (encoded != NULL) { Py_INCREF(encoded); @@ -2261,13 +2300,15 @@ if (kstr == NULL) goto bail; } - else if (PyInt_Check(key) || PyLong_Check(key)) { - kstr = PyObject_Str(key); + else if (key == Py_True || key == Py_False || key == Py_None) { + /* This must come before the PyInt_Check because + True and False are also 1 and 0.*/ + kstr = _encoded_const(key); if (kstr == NULL) goto bail; } - else if (key == Py_True || key == Py_False || key == Py_None) { - kstr = _encoded_const(key); + else if (PyInt_Check(key) || PyLong_Check(key)) { + kstr = PyObject_Str(key); if (kstr == NULL) goto bail; } @@ -2277,7 +2318,7 @@ } else { /* TODO: include repr of key */ - PyErr_SetString(PyExc_ValueError, "keys must be a string"); + PyErr_SetString(PyExc_TypeError, "keys must be a string"); goto bail; } @@ -2326,7 +2367,7 @@ bail: Py_XDECREF(encoded); - Py_XDECREF(item); + Py_XDECREF(items); Py_XDECREF(iter); Py_XDECREF(kstr); Py_XDECREF(ident); Files old/simplejson-2.1.1/simplejson/.__speedups.c and new/simplejson-2.1.3/simplejson/.__speedups.c differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/__init__.py new/simplejson-2.1.3/simplejson/tests/__init__.py --- old/simplejson-2.1.1/simplejson/tests/__init__.py 2010-03-08 04:13:22.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/__init__.py 2010-07-12 20:21:25.000000000 +0200 @@ -33,6 +33,7 @@ 'simplejson.tests.test_dump', 'simplejson.tests.test_encode_basestring_ascii', 'simplejson.tests.test_encode_for_html', + 'simplejson.tests.test_errors', 'simplejson.tests.test_fail', 'simplejson.tests.test_float', 'simplejson.tests.test_indent', Files old/simplejson-2.1.1/simplejson/tests/.___init__.py and new/simplejson-2.1.3/simplejson/tests/.___init__.py differ Files old/simplejson-2.1.1/simplejson/tests/._test_decimal.py and new/simplejson-2.1.3/simplejson/tests/._test_decimal.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_decimal.py new/simplejson-2.1.3/simplejson/tests/test_decimal.py --- old/simplejson-2.1.1/simplejson/tests/test_decimal.py 2010-03-08 04:30:30.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_decimal.py 2011-01-17 02:25:24.000000000 +0100 @@ -1,33 +1,50 @@ from decimal import Decimal from unittest import TestCase +from StringIO import StringIO import simplejson as json class TestDecimal(TestCase): NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500" + def dumps(self, obj, **kw): + sio = StringIO() + json.dump(obj, sio, **kw) + res = json.dumps(obj, **kw) + self.assertEquals(res, sio.getvalue()) + return res + + def loads(self, s, **kw): + sio = StringIO(s) + res = json.loads(s, **kw) + self.assertEquals(res, json.load(sio, **kw)) + return res + def test_decimal_encode(self): for d in map(Decimal, self.NUMS): - self.assertEquals(json.dumps(d, use_decimal=True), str(d)) + self.assertEquals(self.dumps(d, use_decimal=True), str(d)) def test_decimal_decode(self): for s in self.NUMS: - self.assertEquals(json.loads(s, parse_float=Decimal), Decimal(s)) + self.assertEquals(self.loads(s, parse_float=Decimal), Decimal(s)) def test_decimal_roundtrip(self): for d in map(Decimal, self.NUMS): # The type might not be the same (int and Decimal) but they # should still compare equal. self.assertEquals( - json.loads( - json.dumps(d, use_decimal=True), parse_float=Decimal), + self.loads( + self.dumps(d, use_decimal=True), parse_float=Decimal), d) self.assertEquals( - json.loads( - json.dumps([d], use_decimal=True), parse_float=Decimal), + self.loads( + self.dumps([d], use_decimal=True), parse_float=Decimal), [d]) def test_decimal_defaults(self): d = Decimal(1) + sio = StringIO() # use_decimal=False is the default self.assertRaises(TypeError, json.dumps, d, use_decimal=False) - self.assertRaises(TypeError, json.dumps, d) \ No newline at end of file + self.assertRaises(TypeError, json.dumps, d) + self.assertRaises(TypeError, json.dump, d, sio, use_decimal=False) + self.assertRaises(TypeError, json.dump, d, sio) \ No newline at end of file Files old/simplejson-2.1.1/simplejson/tests/._test_decode.py and new/simplejson-2.1.3/simplejson/tests/._test_decode.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_decode.py new/simplejson-2.1.3/simplejson/tests/test_decode.py --- old/simplejson-2.1.1/simplejson/tests/test_decode.py 2010-02-25 18:16:22.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_decode.py 2010-11-01 10:28:51.000000000 +0100 @@ -71,3 +71,13 @@ self.assertEqual(json.loads(u'""'), u"") self.assertEqual(json.loads('[""]'), [""]) self.assertEqual(json.loads(u'[""]'), [u""]) + + def test_raw_decode(self): + cls = json.decoder.JSONDecoder + self.assertEqual( + ({'a': {}}, 9), + cls().raw_decode("{\"a\": {}}")) + # http://code.google.com/p/simplejson/issues/detail?id=85 + self.assertEqual( + ({'a': {}}, 9), + cls(object_pairs_hook=dict).raw_decode("{\"a\": {}}")) Files old/simplejson-2.1.1/simplejson/tests/._test_default.py and new/simplejson-2.1.3/simplejson/tests/._test_default.py differ Files old/simplejson-2.1.1/simplejson/tests/._test_dump.py and new/simplejson-2.1.3/simplejson/tests/._test_dump.py differ Files old/simplejson-2.1.1/simplejson/tests/._test_encode_basestring_ascii.py and new/simplejson-2.1.3/simplejson/tests/._test_encode_basestring_ascii.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_encode_basestring_ascii.py new/simplejson-2.1.3/simplejson/tests/test_encode_basestring_ascii.py --- old/simplejson-2.1.1/simplejson/tests/test_encode_basestring_ascii.py 2009-02-22 22:33:35.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_encode_basestring_ascii.py 2010-11-05 03:39:21.000000000 +0100 @@ -39,3 +39,8 @@ # result, expect, fname, input_string)) self.assertEquals(result, expect, '%r != %r for %s(%r)' % (result, expect, fname, input_string)) + + def test_sorted_dict(self): + items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)] + s = simplejson.dumps(dict(items), sort_keys=True) + self.assertEqual(s, '{"five": 5, "four": 4, "one": 1, "three": 3, "two": 2}') Files old/simplejson-2.1.1/simplejson/tests/._test_errors.py and new/simplejson-2.1.3/simplejson/tests/._test_errors.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_errors.py new/simplejson-2.1.3/simplejson/tests/test_errors.py --- old/simplejson-2.1.1/simplejson/tests/test_errors.py 1970-01-01 01:00:00.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_errors.py 2010-07-19 06:17:41.000000000 +0200 @@ -0,0 +1,21 @@ +from unittest import TestCase + +import simplejson as json + +class TestErrors(TestCase): + def test_string_keys_error(self): + data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}] + self.assertRaises(TypeError, json.dumps, data) + + def test_decode_error(self): + err = None + try: + json.loads('{}\na\nb') + except json.JSONDecodeError, e: + err = e + else: + self.fail('Expected JSONDecodeError') + self.assertEquals(err.lineno, 2) + self.assertEquals(err.colno, 1) + self.assertEquals(err.endlineno, 3) + self.assertEquals(err.endcolno, 2) Files old/simplejson-2.1.1/simplejson/tests/._test_fail.py and new/simplejson-2.1.3/simplejson/tests/._test_fail.py differ Files old/simplejson-2.1.1/simplejson/tests/._test_float.py and new/simplejson-2.1.3/simplejson/tests/._test_float.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_indent.py new/simplejson-2.1.3/simplejson/tests/test_indent.py --- old/simplejson-2.1.1/simplejson/tests/test_indent.py 2010-02-25 18:16:22.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_indent.py 2010-10-08 09:38:29.000000000 +0200 @@ -2,6 +2,7 @@ import simplejson as json import textwrap +from StringIO import StringIO class TestIndent(TestCase): def test_indent(self): @@ -51,3 +52,18 @@ # so the following is expected to fail. Python 2.4 is not a # supported platform in simplejson 2.1.0+. self.assertEquals(d2, expect) + + def test_indent0(self): + h = {3: 1} + def check(indent, expected): + d1 = json.dumps(h, indent=indent) + self.assertEquals(d1, expected) + + sio = StringIO() + json.dump(h, sio, indent=indent) + self.assertEquals(sio.getvalue(), expected) + + # indent=0 should emit newlines + check(0, '{\n"3": 1\n}') + # indent=None is more compact + check(None, '{"3": 1}') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_recursion.py new/simplejson-2.1.3/simplejson/tests/test_recursion.py --- old/simplejson-2.1.1/simplejson/tests/test_recursion.py 2009-02-16 02:40:35.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_recursion.py 2010-10-08 09:41:27.000000000 +0200 @@ -53,7 +53,7 @@ x = {} y = {"a": x, "b": x} # ensure that the marker is cleared - json.dumps(x) + json.dumps(y) def test_defaultrecursion(self): enc = RecursiveJSONEncoder() Files old/simplejson-2.1.1/simplejson/tests/._test_separators.py and new/simplejson-2.1.3/simplejson/tests/._test_separators.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson/tests/test_speedups.py new/simplejson-2.1.3/simplejson/tests/test_speedups.py --- old/simplejson-2.1.1/simplejson/tests/test_speedups.py 2010-03-13 22:27:36.000000000 +0100 +++ new/simplejson-2.1.3/simplejson/tests/test_speedups.py 2010-10-08 09:42:00.000000000 +0200 @@ -1,7 +1,6 @@ -import decimal from unittest import TestCase -from simplejson import decoder, encoder, scanner +from simplejson import encoder, scanner def has_speedups(): return encoder.c_make_encoder is not None Files old/simplejson-2.1.1/simplejson/tests/._test_unicode.py and new/simplejson-2.1.3/simplejson/tests/._test_unicode.py differ Files old/simplejson-2.1.1/simplejson/._tool.py and new/simplejson-2.1.3/simplejson/._tool.py differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson.egg-info/PKG-INFO new/simplejson-2.1.3/simplejson.egg-info/PKG-INFO --- old/simplejson-2.1.1/simplejson.egg-info/PKG-INFO 2010-04-01 01:11:15.000000000 +0200 +++ new/simplejson-2.1.3/simplejson.egg-info/PKG-INFO 2011-01-17 02:30:37.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: simplejson -Version: 2.1.1 +Version: 2.1.3 Summary: Simple, fast, extensible JSON encoder/decoder for Python Home-page: http://undefined.org/python/#simplejson Author: Bob Ippolito diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplejson-2.1.1/simplejson.egg-info/SOURCES.txt new/simplejson-2.1.3/simplejson.egg-info/SOURCES.txt --- old/simplejson-2.1.1/simplejson.egg-info/SOURCES.txt 2010-04-01 01:11:15.000000000 +0200 +++ new/simplejson-2.1.3/simplejson.egg-info/SOURCES.txt 2011-01-17 02:30:37.000000000 +0100 @@ -49,6 +49,7 @@ simplejson/tests/test_dump.py simplejson/tests/test_encode_basestring_ascii.py simplejson/tests/test_encode_for_html.py +simplejson/tests/test_errors.py simplejson/tests/test_fail.py simplejson/tests/test_float.py simplejson/tests/test_indent.py ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org