diff -Nru jsonpickle-0.9.2/COPYING jsonpickle-0.9.3/COPYING --- jsonpickle-0.9.2/COPYING 2013-08-20 09:08:23.000000000 +0000 +++ jsonpickle-0.9.3/COPYING 2016-03-09 09:01:41.000000000 +0000 @@ -1,5 +1,5 @@ Copyright (C) 2008 John Paulett (john -at- paulett.org) -Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com) +Copyright (C) 2009-2016 David Aguilar (davvid -at- gmail.com) All rights reserved. Redistribution and use in source and binary forms, with or without diff -Nru jsonpickle-0.9.2/debian/changelog jsonpickle-0.9.3/debian/changelog --- jsonpickle-0.9.2/debian/changelog 2015-09-13 16:36:23.000000000 +0000 +++ jsonpickle-0.9.3/debian/changelog 2016-03-09 10:06:31.000000000 +0000 @@ -1,3 +1,19 @@ +jsonpickle (0.9.3-2) unstable; urgency=medium + + * Improve the way we call the test suite, based on suggestion of Piotr. + + -- Raphaël Hertzog Wed, 09 Mar 2016 11:05:43 +0100 + +jsonpickle (0.9.3-1) unstable; urgency=medium + + * Team upload. + * New upstream version. + * Includes fixes for NumPy 1.10.x. Closes: #812114 + * Update Standards-Version to 3.9.7. + * Update Vcs-Git to use https URL. + + -- Raphaël Hertzog Wed, 09 Mar 2016 10:26:45 +0100 + jsonpickle (0.9.2-1) unstable; urgency=medium * New upstream version diff -Nru jsonpickle-0.9.2/debian/control jsonpickle-0.9.3/debian/control --- jsonpickle-0.9.2/debian/control 2015-09-13 16:32:15.000000000 +0000 +++ jsonpickle-0.9.3/debian/control 2016-03-09 10:06:31.000000000 +0000 @@ -14,9 +14,9 @@ python3-feedparser, python3-numpy, python3-simplejson -Standards-Version: 3.9.6 -Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/jsonpickle/trunk -Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/jsonpickle/trunk/ +Standards-Version: 3.9.7 +Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/jsonpickle.git +Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/jsonpickle.git Homepage: http://jsonpickle.github.com X-Python-Version: >= 2.6 X-Python3-Version: >= 3.2 diff -Nru jsonpickle-0.9.2/debian/.git-dpm jsonpickle-0.9.3/debian/.git-dpm --- jsonpickle-0.9.2/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 +++ jsonpickle-0.9.3/debian/.git-dpm 2016-03-09 10:06:31.000000000 +0000 @@ -0,0 +1,11 @@ +# see git-dpm(1) from git-dpm package +954e96343fec266a3d9e686835a9b6b439109bae +954e96343fec266a3d9e686835a9b6b439109bae +e937fb67527297c47b28988d26a27bae533355f7 +e937fb67527297c47b28988d26a27bae533355f7 +jsonpickle_0.9.3.orig.tar.gz +86b76d8047170a279f3c7a7e1513a84e09c52486 +60489 +debianTag="debian/%e%v" +patchedTag="patched/%e%v" +upstreamTag="upstream/%e%u" diff -Nru jsonpickle-0.9.2/debian/patches/disable-tests-for-unpackaged-libraries.patch jsonpickle-0.9.3/debian/patches/disable-tests-for-unpackaged-libraries.patch --- jsonpickle-0.9.2/debian/patches/disable-tests-for-unpackaged-libraries.patch 2014-02-01 22:44:18.000000000 +0000 +++ jsonpickle-0.9.3/debian/patches/disable-tests-for-unpackaged-libraries.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Author: Jan Dittberner -Subject: Disable UJson test ---- a/tests/backends_tests.py -+++ b/tests/backends_tests.py -@@ -157,7 +157,7 @@ - def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(JsonTestCase)) -- suite.addTest(unittest.makeSuite(UJsonTestCase)) -+ #suite.addTest(unittest.makeSuite(UJsonTestCase)) - if not PY32: - suite.addTest(unittest.makeSuite(SimpleJsonTestCase)) - if PY2: diff -Nru jsonpickle-0.9.2/debian/patches/disable-unsupported-sphinx-extension.patch jsonpickle-0.9.3/debian/patches/disable-unsupported-sphinx-extension.patch --- jsonpickle-0.9.2/debian/patches/disable-unsupported-sphinx-extension.patch 2014-02-02 09:39:06.000000000 +0000 +++ jsonpickle-0.9.3/debian/patches/disable-unsupported-sphinx-extension.patch 2016-03-09 10:06:31.000000000 +0000 @@ -1,8 +1,19 @@ -Author: Jan Dittberner -Subject: disable Sphinx extensions not available in Debian or requiring remote access +From 954e96343fec266a3d9e686835a9b6b439109bae Mon Sep 17 00:00:00 2001 +From: Jan Dittberner +Date: Thu, 8 Oct 2015 09:25:42 -0700 +Subject: disable Sphinx extensions not available in Debian or requiring remote + access + +Patch-Name: disable-unsupported-sphinx-extension.patch +--- + docs/source/conf.py | 19 +------------------ + 1 file changed, 1 insertion(+), 18 deletions(-) + +diff --git a/docs/source/conf.py b/docs/source/conf.py +index 8be2120..ea9c64b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py -@@ -19,24 +19,11 @@ +@@ -19,24 +19,11 @@ import sys, os sys.path.insert(0, os.path.abspath(os.path.join('..', '..'))) import jsonpickle @@ -28,7 +39,7 @@ # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] -@@ -206,7 +193,3 @@ +@@ -206,7 +193,3 @@ latex_documents = [ # If false, no module index is generated. #latex_use_modindex = True diff -Nru jsonpickle-0.9.2/debian/rules jsonpickle-0.9.3/debian/rules --- jsonpickle-0.9.2/debian/rules 2015-09-13 16:16:53.000000000 +0000 +++ jsonpickle-0.9.3/debian/rules 2016-03-09 10:06:31.000000000 +0000 @@ -8,7 +8,7 @@ override_dh_auto_test: PYBUILD_SYSTEM=custom \ - PYBUILD_TEST_ARGS="tests/runtests.py" dh_auto_test + PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} {interpreter} tests/runtests.py" dh_auto_test override_dh_installchangelogs: dh_installchangelogs -i docs/source/changelog.rst diff -Nru jsonpickle-0.9.2/docs/source/api.rst jsonpickle-0.9.3/docs/source/api.rst --- jsonpickle-0.9.2/docs/source/api.rst 2013-08-22 08:05:51.000000000 +0000 +++ jsonpickle-0.9.3/docs/source/api.rst 2015-11-03 03:07:13.000000000 +0000 @@ -57,6 +57,8 @@ .. autofunction:: jsonpickle.set_encoder_options +.. autofunction:: jsonpickle.set_decoder_options + Customizing JSON output ----------------------- diff -Nru jsonpickle-0.9.2/docs/source/changelog.rst jsonpickle-0.9.3/docs/source/changelog.rst --- jsonpickle-0.9.2/docs/source/changelog.rst 2015-03-20 07:21:40.000000000 +0000 +++ jsonpickle-0.9.3/docs/source/changelog.rst 2016-03-09 09:01:41.000000000 +0000 @@ -1,5 +1,20 @@ Change Log ========== + +Version 0.9.3 - March 9, 2016 +----------------------------- + * UUID objects can now be serialized + (`#130 `_). + + * Added `set_decoder_options` method to allow decoder specific options + equal to `set_encoder_options`. + + * Int keys can be encoded directly by e.g. demjson by passing + `numeric_keys=True` and setting its backend options via + `jsonpickle.set_encoder_options('demjson', strict=False)`. + + * Newer Numpy versions (v1.10+) are now supported. + Version 0.9.2 - March 20, 2015 ------------------------------ * Fixes for serializing objects with custom handlers. diff -Nru jsonpickle-0.9.2/docs/source/index.rst jsonpickle-0.9.3/docs/source/index.rst --- jsonpickle-0.9.2/docs/source/index.rst 2014-09-02 20:35:47.000000000 +0000 +++ jsonpickle-0.9.3/docs/source/index.rst 2016-03-09 09:01:41.000000000 +0000 @@ -96,4 +96,4 @@ `New BSD license `_, Copyright (C) 2008-2011 John Paulett (john -at- paulett.org) -Copyright (C) 2009-2013 David Aguilar (davvid -at- gmail.com) +Copyright (C) 2009-2016 David Aguilar (davvid -at- gmail.com) diff -Nru jsonpickle-0.9.2/jsonpickle/backend.py jsonpickle-0.9.3/jsonpickle/backend.py --- jsonpickle-0.9.2/jsonpickle/backend.py 2015-01-10 06:35:15.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/backend.py 2015-11-03 03:07:13.000000000 +0000 @@ -33,6 +33,9 @@ 'django.util.simplejson': json_opts, } + # Options to pass to specific encoders + self._decoder_options = {} + # The exception class that is thrown when a decoding error occurs self._decoder_exceptions = {} @@ -120,8 +123,9 @@ # simplejson uses ValueError self._decoder_exceptions[name] = loads_exc - # Setup the default args and kwargs for this encoder + # Setup the default args and kwargs for this encoder/decoder self._encoder_options[name] = ([], {}) + self._decoder_options[name] = ([], {}) # Add this backend to the list of candidate backends self._backend_names.append(name) @@ -135,6 +139,7 @@ self._encoders.pop(name, None) self._decoders.pop(name, None) self._decoder_exceptions.pop(name, None) + self._decoder_options.pop(name, None) self._encoder_options.pop(name, None) if name in self._backend_names: self._backend_names.remove(name) @@ -156,10 +161,7 @@ for idx, name in enumerate(self._backend_names): try: - optargs, optkwargs = self._encoder_options[name] - encoder_kwargs = optkwargs.copy() - encoder_args = (obj,) + tuple(optargs) - return self._encoders[name](*encoder_args, **encoder_kwargs) + return self.backend_encode(name, obj) except Exception as e: if idx == len(self._backend_names) - 1: raise e @@ -198,7 +200,9 @@ loads = decode def backend_decode(self, name, string): - return self._decoders[name](string) + optargs, optkwargs = self._decoder_options.get(name, ((), {})) + decoder_kwargs = optkwargs.copy() + return self._decoders[name](string, *optargs, **decoder_kwargs) def set_preferred_backend(self, name): """ @@ -244,6 +248,25 @@ """ self._encoder_options[name] = (args, kwargs) + def set_decoder_options(self, name, *args, **kwargs): + """ + Associate decoder-specific options with a decoder. + + After calling set_decoder_options, any calls to jsonpickle's + decode method will pass the supplied args and kwargs along to + the appropriate backend's decode method. + + For example:: + + set_decoder_options('simplejson', encoding='utf8', cls=JSONDecoder) + set_decoder_options('demjson', strict=True) + + See the appropriate decoder's documentation for details about + the supported arguments and keyword arguments. + + """ + self._decoder_options[name] = (args, kwargs) + def _store(self, dct, backend, obj, name): try: dct[backend] = getattr(obj, name) diff -Nru jsonpickle-0.9.2/jsonpickle/compat.py jsonpickle-0.9.3/jsonpickle/compat.py --- jsonpickle-0.9.2/jsonpickle/compat.py 2015-01-10 06:35:15.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/compat.py 2015-11-05 05:40:48.000000000 +0000 @@ -26,8 +26,10 @@ try: long = long + numeric_types = (int, long) except NameError: long = int + numeric_types = (int,) try: unichr = unichr diff -Nru jsonpickle-0.9.2/jsonpickle/ext/numpy.py jsonpickle-0.9.3/jsonpickle/ext/numpy.py --- jsonpickle-0.9.2/jsonpickle/ext/numpy.py 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/ext/numpy.py 2016-03-09 08:17:26.000000000 +0000 @@ -12,16 +12,29 @@ class NumpyBaseHandler(jsonpickle.handlers.BaseHandler): + def restore_dtype(self, data): dtype = data['dtype'] if dtype.startswith(('{', '[')): return ast.literal_eval(dtype) return np.dtype(dtype) + def flatten_dtype(self, dtype, data): + + if hasattr(dtype, 'tostring'): + data['dtype'] = dtype.tostring() + else: + dtype = unicode(dtype) + prefix = '(numpy.record, ' + if dtype.startswith(prefix): + dtype = dtype[len(prefix):-1] + data['dtype'] = dtype + class NumpyDTypeHandler(NumpyBaseHandler): + def flatten(self, obj, data): - data['dtype'] = unicode(obj) + self.flatten_dtype(obj, data) return data def restore(self, data): @@ -29,8 +42,9 @@ class NumpyGenericHandler(NumpyBaseHandler): + def flatten(self, obj, data): - data['dtype'] = unicode(obj.dtype) + self.flatten_dtype(obj.dtype, data) data['value'] = self.context.flatten(obj.tolist(), reset=False) return data @@ -40,8 +54,9 @@ class NumpyNDArrayHandler(NumpyBaseHandler): + def flatten(self, obj, data): - data['dtype'] = unicode(obj.dtype) + self.flatten_dtype(obj.dtype, data) data['values'] = self.context.flatten(obj.tolist(), reset=False) return data diff -Nru jsonpickle-0.9.2/jsonpickle/handlers.py jsonpickle-0.9.3/jsonpickle/handlers.py --- jsonpickle-0.9.2/jsonpickle/handlers.py 2015-03-18 08:45:08.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/handlers.py 2015-09-12 08:16:33.000000000 +0000 @@ -29,6 +29,7 @@ import re import sys import time +import uuid from jsonpickle import util from jsonpickle.compat import unicode @@ -278,3 +279,16 @@ def __repr__(self): return ('' % (id(self), self.exemplar)) + + +class UUIDHandler(BaseHandler): + """Serialize uuid.UUID objects""" + + def flatten(self, obj, data): + data['hex'] = obj.hex + return data + + def restore(self, data): + return uuid.UUID(data['hex']) + +UUIDHandler.handles(uuid.UUID) diff -Nru jsonpickle-0.9.2/jsonpickle/__init__.py jsonpickle-0.9.3/jsonpickle/__init__.py --- jsonpickle-0.9.2/jsonpickle/__init__.py 2014-09-19 09:08:41.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/__init__.py 2015-11-05 05:40:48.000000000 +0000 @@ -68,6 +68,7 @@ # Export specific JSONPluginMgr methods into the jsonpickle namespace set_preferred_backend = json.set_preferred_backend +set_decoder_options = json.set_decoder_options set_encoder_options = json.set_encoder_options load_backend = json.load_backend remove_backend = json.remove_backend @@ -81,7 +82,8 @@ max_depth=None, backend=None, warn=False, - max_iter=None): + max_iter=None, + numeric_keys=False): """Return a JSON formatted representation of value, a Python object. :param unpicklable: If set to False then the output will not contain the @@ -128,7 +130,9 @@ make_refs=make_refs, keys=keys, max_depth=max_depth, - warn=warn) + warn=warn, + max_iter=max_iter, + numeric_keys=numeric_keys) def decode(string, backend=None, keys=False): diff -Nru jsonpickle-0.9.2/jsonpickle/pickler.py jsonpickle-0.9.3/jsonpickle/pickler.py --- jsonpickle-0.9.2/jsonpickle/pickler.py 2015-03-15 02:16:34.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/pickler.py 2015-11-05 05:40:48.000000000 +0000 @@ -17,7 +17,7 @@ import jsonpickle.handlers as handlers from jsonpickle.backend import JSONBackend -from jsonpickle.compat import unicode, PY3, PY2 +from jsonpickle.compat import numeric_types, unicode, PY3, PY2 def encode(value, @@ -29,7 +29,8 @@ backend=None, warn=False, context=None, - max_iter=None): + max_iter=None, + numeric_keys=False): backend = _make_backend(backend) if context is None: context = Pickler(unpicklable=unpicklable, @@ -38,7 +39,8 @@ backend=backend, max_depth=max_depth, warn=warn, - max_iter=max_iter) + max_iter=max_iter, + numeric_keys=numeric_keys) return backend.encode(context.flatten(value, reset=reset)) @@ -58,12 +60,14 @@ backend=None, keys=False, warn=False, - max_iter=None): + max_iter=None, + numeric_keys=False): self.unpicklable = unpicklable self.make_refs = make_refs self.backend = _make_backend(backend) self.keys = keys self.warn = warn + self.numeric_keys = numeric_keys # The current recursion depth self._depth = -1 # The maximal recursion depth @@ -482,7 +486,10 @@ else: if k is None: k = 'null' # for compatibility with common json encoders - if not isinstance(k, (str, unicode)): + + if self.numeric_keys and isinstance(k, numeric_types): + pass + elif not isinstance(k, (str, unicode)): try: k = repr(k) except: diff -Nru jsonpickle-0.9.2/jsonpickle/unpickler.py jsonpickle-0.9.3/jsonpickle/unpickler.py --- jsonpickle-0.9.2/jsonpickle/unpickler.py 2015-03-18 09:11:00.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/unpickler.py 2016-03-09 08:34:29.000000000 +0000 @@ -14,7 +14,7 @@ import jsonpickle.tags as tags import jsonpickle.handlers as handlers -from jsonpickle.compat import set +from jsonpickle.compat import numeric_types, set, unicode from jsonpickle.backend import JSONBackend @@ -204,6 +204,7 @@ for k, v in dictitems: stage1.__setitem__(k, v) + self._mkref(stage1) return stage1 def _restore_id(self, obj): @@ -315,7 +316,11 @@ # ignore the reserved attribute if ignorereserved and k in tags.RESERVED: continue - self._namestack.append(k) + if isinstance(k, numeric_types): + str_k = unicode(k) + else: + str_k = k + self._namestack.append(str_k) k = restore_key(k) # step into the namespace value = self._restore(v) @@ -398,7 +403,11 @@ data = {} restore_key = self._restore_key_fn() for k, v in sorted(obj.items(), key=util.itemgetter): - self._namestack.append(k) + if isinstance(k, numeric_types): + str_k = unicode(k) + else: + str_k = k + self._namestack.append(str_k) k = restore_key(k) data[k] = self._restore(v) self._namestack.pop() diff -Nru jsonpickle-0.9.2/jsonpickle/version.py jsonpickle-0.9.3/jsonpickle/version.py --- jsonpickle-0.9.2/jsonpickle/version.py 2015-03-20 07:21:46.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle/version.py 2016-03-09 09:01:41.000000000 +0000 @@ -1 +1 @@ -VERSION = '0.9.2' +VERSION = '0.9.3' diff -Nru jsonpickle-0.9.2/jsonpickle.egg-info/PKG-INFO jsonpickle-0.9.3/jsonpickle.egg-info/PKG-INFO --- jsonpickle-0.9.2/jsonpickle.egg-info/PKG-INFO 2015-03-20 07:44:05.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle.egg-info/PKG-INFO 2016-03-09 09:02:27.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: jsonpickle -Version: 0.9.2 +Version: 0.9.3 Summary: Python library for serializing any arbitrary object graph into JSON Home-page: http://jsonpickle.github.io/ Author: David Aguilar diff -Nru jsonpickle-0.9.2/jsonpickle.egg-info/SOURCES.txt jsonpickle-0.9.3/jsonpickle.egg-info/SOURCES.txt --- jsonpickle-0.9.2/jsonpickle.egg-info/SOURCES.txt 2015-03-20 07:44:06.000000000 +0000 +++ jsonpickle-0.9.3/jsonpickle.egg-info/SOURCES.txt 2016-03-09 09:02:27.000000000 +0000 @@ -1,7 +1,6 @@ COPYING MANIFEST.in README.rst -Rakefile requirements-2.txt requirements-3.txt requirements-test.txt @@ -50,4 +49,5 @@ tests/numpy_test.py tests/object_test.py tests/runtests.py +tests/stdlib_test.py tests/util_test.py \ No newline at end of file diff -Nru jsonpickle-0.9.2/PKG-INFO jsonpickle-0.9.3/PKG-INFO --- jsonpickle-0.9.2/PKG-INFO 2015-03-20 07:44:06.000000000 +0000 +++ jsonpickle-0.9.3/PKG-INFO 2016-03-09 09:02:28.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: jsonpickle -Version: 0.9.2 +Version: 0.9.3 Summary: Python library for serializing any arbitrary object graph into JSON Home-page: http://jsonpickle.github.io/ Author: David Aguilar diff -Nru jsonpickle-0.9.2/Rakefile jsonpickle-0.9.3/Rakefile --- jsonpickle-0.9.2/Rakefile 2014-03-25 08:10:14.000000000 +0000 +++ jsonpickle-0.9.3/Rakefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -VERSION_FILE = File.open('jsonpickle/version.py').gets.strip -eval VERSION_FILE -PYTHON_ENVS = [:env26, :env27, :env32, :env33, :env34] -PYTHON_EXECS = {:env26 => "python2.6", - :env27 => "python2.7", - :env32 => "python3.2", - :env33 => "python3.3", - :env34 => "python3.4"} - -def colorize(text, color) - color_codes = { - :black => 30, - :red => 31, - :green => 32, - :yellow => 33, - :blue => 34, - :magenta => 35, - :cyan => 36, - :white => 37 - } - code = color_codes[color] - if code == nil - text - else - "\033[#{code}m#{text}\033[0m" - end -end - -def virtual_env(command, env="env33") - sh "source #{env}/bin/activate ; #{command}" -end - -def create_virtual_env(dir, python) - sh "virtualenv #{dir} -p #{python}" -end - -task :clean => [] do - sh "rm -rf ~*" - sh "rm -rf *.pyc *.pyo" - sh "rm -rf data/" - sh "rm -rf *.egg-info" - sh "rm -rf dist/" -end - -task :install => [] do - sh "python --version" - sh "ruby --version" - sh "easy_install pip" -end - -task :dev_env => [] do - PYTHON_ENVS.each { |env| - puts colorize("Environment #{env}", :blue) - create_virtual_env(env, PYTHON_EXECS[env]) - } -end - -task :dependencies => [:dev_env] do - PYTHON_ENVS.each { |env| - puts colorize("Environment #{env}", :blue) - virtual_env("pip install -r requirements.txt", "#{env}") - virtual_env("pip install -r requirements-test.txt", "#{env}") - } -end - -task :tests => [] do - PYTHON_ENVS.each { |env| - puts colorize("Environment #{env}", :blue) - virtual_env("nosetests", env) - } -end - -task :default => [:tests] - diff -Nru jsonpickle-0.9.2/README.rst jsonpickle-0.9.3/README.rst --- jsonpickle-0.9.2/README.rst 2014-09-06 08:03:54.000000000 +0000 +++ jsonpickle-0.9.3/README.rst 2015-08-12 09:21:41.000000000 +0000 @@ -13,9 +13,26 @@ Install ======= +Install from pip for the latest stable release: + +:: + + pip install jsonpickle + +Install from github for the latest changes: + :: - python setup.py install + pip install git+https://github.com/jsonpickle/jsonpickle.git + +If you have the files checked out for development: + +:: + + git clone https://github.com/jsonpickle/jsonpickle.git + cd jsonpickle + python setup.py develop + jsonpickleJS ============ diff -Nru jsonpickle-0.9.2/requirements-3.txt jsonpickle-0.9.3/requirements-3.txt --- jsonpickle-0.9.2/requirements-3.txt 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/requirements-3.txt 2016-03-09 08:35:56.000000000 +0000 @@ -1,2 +1,4 @@ +feedparser +demjson simplejson ujson diff -Nru jsonpickle-0.9.2/setup.py jsonpickle-0.9.3/setup.py --- jsonpickle-0.9.2/setup.py 2015-03-18 07:50:34.000000000 +0000 +++ jsonpickle-0.9.3/setup.py 2016-03-09 09:01:41.000000000 +0000 @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2008 John Paulett (john -at- paulett.org) -# Copyright (C) 2009-2013 David Aguilar (davvid -at- gmail.com) +# Copyright (C) 2009-2016 David Aguilar (davvid -at- gmail.com) # All rights reserved. # # This software is licensed as described in the file COPYING, which diff -Nru jsonpickle-0.9.2/tests/backend_test.py jsonpickle-0.9.3/tests/backend_test.py --- jsonpickle-0.9.2/tests/backend_test.py 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/tests/backend_test.py 2016-03-09 08:40:46.000000000 +0000 @@ -107,13 +107,11 @@ class DemjsonTestCase(BackendBase): + def setUp(self): - if PY2: - self.set_preferred_backend('demjson') + self.set_preferred_backend('demjson') def test_backend(self): - if PY3: - return self.skip('no demjson for python3') expected_pickled = unicode( '{"things":[{' '"child":null,' @@ -122,6 +120,13 @@ ']}') self.assertEncodeDecode(expected_pickled) + def test_int_dict_keys_with_numeric_keys(self): + jsonpickle.set_encoder_options('demjson', strict=False) + int_dict = {1000: [1, 2]} + pickle = jsonpickle.encode(int_dict, numeric_keys=True) + actual = jsonpickle.decode(pickle) + self.assertEqual(actual[1000], [1, 2]) + class JsonlibTestCase(BackendBase): def setUp(self): @@ -141,12 +146,9 @@ class YajlTestCase(BackendBase): def setUp(self): - if PY2: - self.set_preferred_backend('yajl') + self.set_preferred_backend('yajl') def test_backend(self): - if PY3: - return self.skip('no yajl for python3') expected_pickled = ( '{"things":[{' '"py/object":"backend_test.Thing",' @@ -175,11 +177,11 @@ suite.addTest(unittest.makeSuite(UJsonTestCase)) if not PY32: suite.addTest(unittest.makeSuite(SimpleJsonTestCase)) + if has_module('demjson'): + suite.addTest(unittest.makeSuite(DemjsonTestCase)) + if has_module('yajl'): + suite.addTest(unittest.makeSuite(YajlTestCase)) if PY2: - if has_module('demjson'): - suite.addTest(unittest.makeSuite(DemjsonTestCase)) - if has_module('yajl'): - suite.addTest(unittest.makeSuite(YajlTestCase)) if has_module('jsonlib'): suite.addTest(unittest.makeSuite(JsonlibTestCase)) return suite diff -Nru jsonpickle-0.9.2/tests/helper.py jsonpickle-0.9.3/tests/helper.py --- jsonpickle-0.9.2/tests/helper.py 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/tests/helper.py 2016-03-09 07:30:15.000000000 +0000 @@ -2,6 +2,7 @@ class SkippableTest(unittest.TestCase): + def skip(self, msg): if hasattr(self, 'skipTest'): return self.skipTest(msg) diff -Nru jsonpickle-0.9.2/tests/numpy_test.py jsonpickle-0.9.3/tests/numpy_test.py --- jsonpickle-0.9.2/tests/numpy_test.py 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/tests/numpy_test.py 2016-03-09 07:31:51.000000000 +0000 @@ -25,6 +25,8 @@ jsonpickle.ext.numpy.register_handlers() def tearDown(self): + if self.should_skip: + return import jsonpickle.ext.numpy jsonpickle.ext.numpy.unregister_handlers() diff -Nru jsonpickle-0.9.2/tests/object_test.py jsonpickle-0.9.3/tests/object_test.py --- jsonpickle-0.9.2/tests/object_test.py 2015-03-20 07:24:06.000000000 +0000 +++ jsonpickle-0.9.3/tests/object_test.py 2016-03-09 08:21:18.000000000 +0000 @@ -732,6 +732,17 @@ self.assertEqual(ec.enum_a, decoded.enum_a) self.assertEqual(ec.enum_b, decoded.enum_b) + def test_enum_references(self): + if IntEnumTest is None: + return self.skip('enum34 module is not installed') + a = IntEnumTest.X + b = IntEnumTest.X + + enums_list = [a, b] + encoded = jsonpickle.encode(enums_list) + decoded = jsonpickle.decode(encoded) + self.assertEqual(enums_list, decoded) + def test_bytes_unicode(self): b1 = b'foo' b2 = b'foo\xff' diff -Nru jsonpickle-0.9.2/tests/runtests.py jsonpickle-0.9.3/tests/runtests.py --- jsonpickle-0.9.2/tests/runtests.py 2015-03-18 08:45:20.000000000 +0000 +++ jsonpickle-0.9.3/tests/runtests.py 2015-08-12 09:26:05.000000000 +0000 @@ -21,6 +21,7 @@ import handler_test import jsonpickle_test import object_test +import stdlib_test import util_test import feedparser_test import bson_test @@ -36,6 +37,7 @@ suite.addTest(datetime_test.suite()) suite.addTest(document_test.suite()) suite.addTest(object_test.suite()) + suite.addTest(stdlib_test.suite()) suite.addTest(feedparser_test.suite()) suite.addTest(numpy_test.suite()) suite.addTest(bson_test.suite()) diff -Nru jsonpickle-0.9.2/tests/stdlib_test.py jsonpickle-0.9.3/tests/stdlib_test.py --- jsonpickle-0.9.2/tests/stdlib_test.py 1970-01-01 00:00:00.000000000 +0000 +++ jsonpickle-0.9.3/tests/stdlib_test.py 2015-08-12 09:45:37.000000000 +0000 @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +"""Test miscellaneous objects from the standard library""" + +import uuid +import unittest + +import jsonpickle + + +class UUIDTestCase(unittest.TestCase): + + def test_random_uuid(self): + u = uuid.uuid4() + encoded = jsonpickle.encode(u) + decoded = jsonpickle.decode(encoded) + + expect = u.hex + actual = decoded.hex + self.assertEqual(expect, actual) + + def test_known_uuid(self): + hex = '28b56adbd18f44e2a5556bba2f23e6f6' + exemplar = uuid.UUID(hex) + encoded = jsonpickle.encode(exemplar) + decoded = jsonpickle.decode(encoded) + + expect = hex + actual = decoded.hex + self.assertEqual(expect, actual) + + +def suite(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(UUIDTestCase)) + return suite + + +if __name__ == '__main__': + unittest.main(defaultTest='suite')