Hello community,

here is the log from the commit of package python-anyjson for openSUSE:Factory 
checked in at 2012-06-26 17:52:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-anyjson (Old)
 and      /work/SRC/openSUSE:Factory/.python-anyjson.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-anyjson", Maintainer is "cth...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-anyjson/python-anyjson.changes    
2012-03-11 20:04:47.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python-anyjson.new/python-anyjson.changes       
2012-06-26 17:52:17.000000000 +0200
@@ -1,0 +2,9 @@
+Fri Jun 22 17:16:37 UTC 2012 - alexan...@exatati.com.br
+
+- Update to 0.3.3:
+  * Fixed bug in buffer object support related to differences between
+    stringIO and cStringIO
+- Aditional changes from 0.3.2:
+  * Added support for buffer objects
+
+-------------------------------------------------------------------

Old:
----
  anyjson-0.3.1.tar.gz

New:
----
  anyjson-0.3.3.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-anyjson.spec ++++++
--- /var/tmp/diff_new_pack.pYaDX5/_old  2012-06-26 17:52:18.000000000 +0200
+++ /var/tmp/diff_new_pack.pYaDX5/_new  2012-06-26 17:52:18.000000000 +0200
@@ -16,22 +16,26 @@
 #
 
 
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+
 Name:           python-anyjson
-Version:        0.3.1
+Version:        0.3.3
 Release:        0
 Summary:        Wraps the best available JSON implementation available in a 
common interface
 License:        BSD-3-Clause
 Group:          Development/Languages/Python
 Url:            http://bitbucket.org/runeh/anyjson
-Source:         anyjson-%{version}.tar.gz
+Source:         anyjson-%{version}.tar.bz2
 BuildRequires:  python-devel
 BuildRequires:  python-distribute
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
+%if 0%{?suse_version}
+%py_requires
+%if 0%{?suse_version} > 1110
 BuildArch:      noarch
 %endif
+%endif
 
 %description
 Anyjson loads whichever is the fastest JSON module installed and provides

++++++ anyjson-0.3.1.tar.gz -> anyjson-0.3.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/CHANGELOG new/anyjson-0.3.3/CHANGELOG
--- old/anyjson-0.3.1/CHANGELOG 2011-03-22 12:00:49.000000000 +0100
+++ new/anyjson-0.3.3/CHANGELOG 2012-06-22 01:09:44.000000000 +0200
@@ -54,4 +54,13 @@
 0.3.1
 
  * Added deprecation warning for cjson and made it the least preferred
-   implementation. See: http://pypi.python.org/pypi/python-cjson/1.0.5
\ No newline at end of file
+   implementation. See: http://pypi.python.org/pypi/python-cjson/1.0.5
+
+0.3.2
+
+ * Added support for buffer objects
+ 
+0.3.3
+
+ * Fixed bug in buffer object support related to differences between
+   stringIO and cStringIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/MANIFEST.in 
new/anyjson-0.3.3/MANIFEST.in
--- old/anyjson-0.3.1/MANIFEST.in       2010-12-03 13:55:40.000000000 +0100
+++ new/anyjson-0.3.3/MANIFEST.in       2012-06-22 00:59:59.000000000 +0200
@@ -1,3 +1,4 @@
 include CHANGELOG
 include README
 include LICENSE
+graft tests
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/PKG-INFO new/anyjson-0.3.3/PKG-INFO
--- old/anyjson-0.3.1/PKG-INFO  2011-03-22 12:14:59.000000000 +0100
+++ new/anyjson-0.3.3/PKG-INFO  2012-06-22 01:12:02.000000000 +0200
@@ -1,8 +1,8 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: anyjson
-Version: 0.3.1
+Version: 0.3.3
 Summary: Wraps the best available JSON implementation available in a common 
interface
-Home-page: http://bitbucket.org/runeh/anyjson
+Home-page: http://bitbucket.org/runeh/anyjson/
 Author: Rune Halvorsen
 Author-email: run...@gmail.com
 License: BSD
@@ -68,7 +68,9 @@
         
 Keywords: json
 Platform: any
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
 Classifier: Intended Audience :: Developers
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
@@ -78,3 +80,6 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.1
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Programming Language :: Python :: Implementation :: Jython
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/anyjson/__init__.py 
new/anyjson-0.3.3/anyjson/__init__.py
--- old/anyjson-0.3.1/anyjson/__init__.py       2011-03-22 12:00:57.000000000 
+0100
+++ new/anyjson-0.3.3/anyjson/__init__.py       2012-06-22 01:08:51.000000000 
+0200
@@ -3,48 +3,44 @@
 
 import sys
 
-__version__ = "0.3.1"
-__author__ = "Rune Halvorsen <run...@gmail.com>"
+VERSION = (0, 3, 3)
+__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
+__author__ = "Rune Halvorsen"
+__contact__ = "run...@gmail.com"
 __homepage__ = "http://bitbucket.org/runeh/anyjson/";
 __docformat__ = "restructuredtext"
 
-implementation = None
-
-"""
-.. function:: serialize(obj)
-
-    Serialize the object to JSON.
-
-.. function:: deserialize(str)
-
-    Deserialize JSON-encoded object to a Python object.
-
-.. function:: force_implementation(name)
-
-    Load a specific json module. This is useful for testing and not much else
+# -eof meta-
 
-.. attribute:: implementation
-
-    The json implementation object. This is probably not useful to you,
-    except to get the name of the implementation in use. The name is
-    available through `implementation.name`.
-
-.. data:: _modules
+#: The json implementation object. This is probably not useful to you,
+#: except to get the name of the implementation in use. The name is
+#: available through ``implementation.name``.
+implementation = None
 
-    List of known json modules, and the names of their serialize/unserialize
-    methods, as well as the exception they throw. Exception can be either
-    an exception class or a string.
-"""
-_modules = [("yajl", "dumps", TypeError, "loads", ValueError),
-            ("jsonlib2", "write", "WriteError", "read", "ReadError"),
-            ("jsonlib", "write", "WriteError", "read", "ReadError"),
-            ("simplejson", "dumps", TypeError, "loads", ValueError),
-            ("json", "dumps", TypeError, "loads", ValueError),
-            ("django.utils.simplejson", "dumps", TypeError, 
"loads",ValueError),
-            ("cjson", "encode", "EncodeError", "decode", "DecodeError")
+# json.loads does not support buffer() objects,
+# so we load() and StringIO instead, and it won't copy.
+if sys.version_info[0] == 3:
+    from io import StringIO
+else:
+    try:
+        from cStringIO import StringIO  # noqa
+    except ImportError:
+        from StringIO import StringIO   # noqa
+
+#: List of known json modules, and the names of their loads/dumps
+#: methods, as well as the exceptions they throw.  Exception can be either
+#: an exception class or a string.
+_modules = [("yajl", "dumps", TypeError, "loads", ValueError, "load"),
+            ("jsonlib2", "write", "WriteError", "read", "ReadError", None),
+            ("jsonlib", "write", "WriteError", "read", "ReadError", None),
+            ("simplejson", "dumps", TypeError, "loads", ValueError, "load"),
+            ("json", "dumps", TypeError, "loads", ValueError, "load"),
+            ("django.utils.simplejson", "dumps", TypeError, "loads", 
ValueError, "load"),
+            ("cjson", "encode", "EncodeError", "decode", "DecodeError", None)
            ]
 
-_fields = ("modname", "encoder", "encerror", "decoder", "decerror")
+_fields = ("modname", "encoder", "encerror",
+           "decoder", "decerror", "filedecoder")
 
 
 class _JsonImplementation(object):
@@ -63,6 +59,8 @@
         self.implementation = modinfo["modname"]
         self._encode = getattr(module, modinfo["encoder"])
         self._decode = getattr(module, modinfo["decoder"])
+        fdec = modinfo["filedecoder"]
+        self._filedecode = fdec and getattr(module, fdec)
         self._encode_error = modinfo["encerror"]
         self._decode_error = modinfo["decerror"]
 
@@ -73,7 +71,7 @@
 
         self.name = modinfo["modname"]
 
-    def __str__(self):
+    def __repr__(self):
         return "<_JsonImplementation instance using %s>" % self.name
 
     def _attempt_load(self, modname):
@@ -82,21 +80,26 @@
         __import__(modname)
         return sys.modules[modname]
 
-    def serialize(self, data):
+    def dumps(self, data):
         """Serialize the datastructure to json. Returns a string. Raises
         TypeError if the object could not be serialized."""
         try:
             return self._encode(data)
         except self._encode_error, exc:
-            raise TypeError(*exc.args)
+            raise TypeError, TypeError(*exc.args), sys.exc_info()[2]
+    serialize = dumps
 
-    def deserialize(self, s):
+    def loads(self, s):
         """deserialize the string to python data types. Raises
-        ValueError if the string vould not be parsed."""
+        ValueError if the string could not be parsed."""
+        # uses StringIO to support buffer objects.
         try:
+            if self._filedecode and not isinstance(s, basestring):
+                return self._filedecode(StringIO(s))
             return self._decode(s)
         except self._decode_error, exc:
-            raise ValueError(*exc.args)
+            raise ValueError, ValueError(*exc.args), sys.exc_info()[2]
+    deserialize = loads
 
 
 def force_implementation(modname):
@@ -126,7 +129,14 @@
     else:
         raise ImportError("No supported JSON module found")
 
-    serialize = lambda value: implementation.serialize(value)
-    deserialize = lambda value: implementation.deserialize(value)
-    dumps = serialize
-    loads = deserialize
+
+    def loads(value):
+        """Serialize the object to JSON."""
+        return implementation.loads(value)
+    deserialize = loads   # compat
+
+
+    def dumps(value):
+        """Deserialize JSON-encoded object to a Python object."""
+        return implementation.dumps(value)
+    serialize = dumps
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/anyjson.egg-info/PKG-INFO 
new/anyjson-0.3.3/anyjson.egg-info/PKG-INFO
--- old/anyjson-0.3.1/anyjson.egg-info/PKG-INFO 2011-03-22 12:14:59.000000000 
+0100
+++ new/anyjson-0.3.3/anyjson.egg-info/PKG-INFO 2012-06-22 01:12:02.000000000 
+0200
@@ -1,8 +1,8 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: anyjson
-Version: 0.3.1
+Version: 0.3.3
 Summary: Wraps the best available JSON implementation available in a common 
interface
-Home-page: http://bitbucket.org/runeh/anyjson
+Home-page: http://bitbucket.org/runeh/anyjson/
 Author: Rune Halvorsen
 Author-email: run...@gmail.com
 License: BSD
@@ -68,7 +68,9 @@
         
 Keywords: json
 Platform: any
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
 Classifier: Intended Audience :: Developers
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
@@ -78,3 +80,6 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.1
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Programming Language :: Python :: Implementation :: Jython
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/anyjson.egg-info/SOURCES.txt 
new/anyjson-0.3.3/anyjson.egg-info/SOURCES.txt
--- old/anyjson-0.3.1/anyjson.egg-info/SOURCES.txt      2011-03-22 
12:14:59.000000000 +0100
+++ new/anyjson-0.3.3/anyjson.egg-info/SOURCES.txt      2012-06-22 
01:12:02.000000000 +0200
@@ -8,4 +8,7 @@
 anyjson.egg-info/SOURCES.txt
 anyjson.egg-info/dependency_links.txt
 anyjson.egg-info/not-zip-safe
-anyjson.egg-info/top_level.txt
\ No newline at end of file
+anyjson.egg-info/top_level.txt
+tests/benchmark.py
+tests/test_implementations.py
+tests/test_implementations.pyc
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/setup.py new/anyjson-0.3.3/setup.py
--- old/anyjson-0.3.1/setup.py  2011-03-22 12:01:28.000000000 +0100
+++ new/anyjson-0.3.3/setup.py  2012-06-22 00:59:59.000000000 +0200
@@ -1,3 +1,4 @@
+import os
 import sys
 
 extra = {}
@@ -9,17 +10,74 @@
 except ImportError:
     from distutils.core import setup, find_packages
 
-author = "Rune Halvorsen"
-email = "run...@gmail.com"
-version = "0.3.1"
-desc = """Wraps the best available JSON implementation available in a common 
interface"""
+# -*- Distribution Meta -*-
+import re
+re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
+re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)')
+re_doc = re.compile(r'^"""(.+?)"""', re.M|re.S)
+rq = lambda s: s.strip("\"'")
+
+def add_default(m):
+    attr_name, attr_value = m.groups()
+    return ((attr_name, rq(attr_value)), )
+
+
+def add_version(m):
+    v = list(map(rq, m.groups()[0].split(", ")))
+    return (("VERSION", ".".join(v[0:3]) + "".join(v[3:])), )
+
+
+def add_doc(m):
+    return (("doc", m.groups()[0].replace("\n", " ")), )
+
+pats = {re_meta: add_default,
+        re_vers: add_version}
+here = os.path.abspath(os.path.dirname(__file__))
+meta_fh = open(os.path.join(here, "anyjson/__init__.py"))
+try:
+    meta = {}
+    acc = []
+    for line in meta_fh:
+        if line.strip() == '# -eof meta-':
+            break
+        acc.append(line)
+        for pattern, handler in pats.items():
+            m = pattern.match(line.strip())
+            if m:
+                meta.update(handler(m))
+    m = re_doc.match("".join(acc).strip())
+    if m:
+        meta.update(add_doc(m))
+finally:
+    meta_fh.close()
+
+
+supported = ["yajl", "jsonlib2", "jsonlib", "simplejson",
+             "json", "django.utils.simplejson", "cjson"]
+install_requires = []
+for module in supported:
+    try:
+        __import__(module)
+        break
+    except ImportError:
+        pass
+else:
+    install_requires.append("simplejson")
+
 
 setup(name='anyjson',
-      version=version,
-      description=desc,
+      version=meta["VERSION"],
+      description=meta["doc"],
+      author=meta["author"],
+      author_email=meta["contact"],
+      url=meta["homepage"],
+      license='BSD',
       long_description=open("README").read(),
+      install_requires=install_requires,
       classifiers=[
+            'Development Status :: 5 - Production/Stable',
             'License :: OSI Approved :: BSD License',
+            'Operating System :: OS Independent',
             'Intended Audience :: Developers',
             'Programming Language :: Python',
             'Programming Language :: Python :: 2',
@@ -29,12 +87,11 @@
             'Programming Language :: Python :: 2.7',
             'Programming Language :: Python :: 3',
             'Programming Language :: Python :: 3.1',
+            'Programming Language :: Python :: Implementation :: CPython',
+            'Programming Language :: Python :: Implementation :: PyPy',
+            'Programming Language :: Python :: Implementation :: Jython',
           ],
       keywords='json',
-      author=author,
-      author_email=email,
-      url='http://bitbucket.org/runeh/anyjson',
-      license='BSD',
       packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
       zip_safe=False,
       platforms=["any"],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/tests/benchmark.py 
new/anyjson-0.3.3/tests/benchmark.py
--- old/anyjson-0.3.1/tests/benchmark.py        1970-01-01 01:00:00.000000000 
+0100
+++ new/anyjson-0.3.3/tests/benchmark.py        2012-06-22 00:59:59.000000000 
+0200
@@ -0,0 +1,143 @@
+"""
+Simple benchmark script to do some basic speed tests of json libs
+"""
+
+import sys
+import time
+import urllib
+
+_small = """
+{
+    "name": "benchmark test",
+    "foo": "bar",
+    "age": 32,
+    "weight": 100,
+    "Height": 154.12,
+    "married": false,
+    "siblings": [],
+    "bar": null
+}
+"""
+
+_deep = """
+{
+    "foo": "bar",
+    "nest": {
+        "foo": %(_small)s,
+        "nest": {
+            "foo": %(_small)s,
+            "nest": {
+                "foo": %(_small)s,
+                "nest": {
+                    "foo": %(_small)s,
+                    "nest": {
+                        "foo": %(_small)s,
+                        "nest": %(_small)s
+                    }
+                }
+            }
+        }
+    }
+}
+""" % locals()
+
+_big = """
+{
+    "biglist": [%(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_deep)s, %(_small)s, %(_deep)s, %(_small)s, %(_deep)s,
+                %(_small)s, %(_small)s, %(_small)s, %(_small)s, %(_small)s],
+    "entry1": %(_small)s,
+    "entry2": %(_deep)s,
+    "entry3": %(_small)s,
+    "entry4": %(_deep)s,
+    "entry5": %(_small)s,
+    "entry6": %(_deep)s
+}
+""" % locals()
+
+# The following two will contain real world json from twitter and reddit if
+# script is run with the --download flag
+_reddit = "[]"
+_twitter = "[]"
+
+def load_external_json():
+    global _reddit, _twitter
+    _reddit = urllib.urlopen("http://reddit.com/.json";).read()
+    _twitter = 
urllib.urlopen("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&count=200";).read()
+
+
+def do_benchmark(impspec, json, runs=10):
+    modulename, parsename, emitname = impspec
+
+    try:
+        __import__(modulename)
+        mod = sys.modules[modulename]
+        reads = getattr(mod, parsename)
+        dumps = getattr(mod, emitname)
+    except:
+        return None
+
+    start = time.time()
+    for n in xrange(runs):
+        data = reads(json)
+
+    readtime = time.time() - start
+
+    start = time.time()
+    for n in xrange(runs):
+        devnull = dumps(data)
+
+    return readtime, time.time() - start # tuple (readtime, writetime)
+
+
+modules = [("json", "loads", "dumps"),
+           ("simplejson", "loads", "dumps"),
+           ("yajl", "loads", "dumps"),
+           ("cjson", "decode", "encode"),
+           ("django.utils.simplejson", "loads", "dumps"),
+           ("jsonpickle", "decode", "encode"),
+           ("jsonlib", "read", "write"),
+           ("jsonlib2", "read", "write"),
+           #("demjson", "decode"), terribly slow. wont include it
+           ]
+
+if len(sys.argv) > 1 and sys.argv[1] == "--download":
+    load_external_json()
+
+res = []
+runs = 100
+for e in modules:
+    res.append((e[0], do_benchmark(e, _small, runs),
+                      do_benchmark(e, _deep , runs),
+                      do_benchmark(e, _big, runs),
+                      do_benchmark(e, _reddit, runs),
+                      do_benchmark(e, _twitter, runs),
+    ))
+
+no_res = set([e for e in res if e[1] is None])
+res = list(set(res) - no_res)
+res = [(e[0], sum(map(lambda x:x[0], e[1:])), sum(map(lambda x:x[1], e[1:]))) 
for e in res]
+
+res.sort(lambda a,b: cmp((a[1]+a[2]), b[1]+b[2]))
+
+print "Total  Read   Write  Implementation"
+print "-----------------------------------"
+for e in res:
+    print "%.3f  %.3f  %.3f  %s" % (e[1]+e[2], e[1], e[2], e[0])
+for e in no_res:
+    print "Not installed:", e[0]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/anyjson-0.3.1/tests/test_implementations.py 
new/anyjson-0.3.3/tests/test_implementations.py
--- old/anyjson-0.3.1/tests/test_implementations.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/anyjson-0.3.3/tests/test_implementations.py     2012-06-22 
00:59:59.000000000 +0200
@@ -0,0 +1,57 @@
+from nose.tools import assert_raises
+import anyjson
+
+modnames = [e[0] for e in anyjson._modules]
+
+def test_default_serialization():
+    assert anyjson.dumps([1,2,3]).replace(" ", "") == "[1,2,3]"
+    assert anyjson.serialize([1,2,3]).replace(" ", "") == "[1,2,3]"
+
+
+def test_default_deserialization():
+    assert anyjson.loads("[1,2,3]") == [1,2,3]
+    assert anyjson.deserialize("[1,2,3]") == [1,2,3]
+
+
+def test_forced_serialization():
+    for name in modnames:
+        try:
+            anyjson.force_implementation(name)
+        except ImportError:
+            continue # module can't be tested, try next
+
+        assert anyjson.dumps([1,2,3]).replace(" ", "") == "[1,2,3]"
+        assert anyjson.serialize([1,2,3]).replace(" ", "") == "[1,2,3]"
+
+
+def test_forced_deserialization():
+    for name in modnames:
+        try:
+            anyjson.force_implementation(name)
+        except ImportError:
+            continue # module can't be tested, try next
+
+        assert anyjson.loads("[1,2,3]") == [1,2,3]
+        assert anyjson.deserialize("[1,2,3]") == [1,2,3]
+
+
+def test_exceptions():
+    for name in modnames:
+        try:
+            anyjson.force_implementation(name)
+        except ImportError:
+            continue # module can't be tested, try next
+
+        assert_raises(TypeError, anyjson.dumps, [object()])
+        assert_raises(TypeError, anyjson.serialize, [object()])
+        assert_raises(ValueError, anyjson.loads, "[")
+        assert_raises(ValueError, anyjson.deserialize, "[")
+
+
+def test_json_loads_unicode():
+    try:
+        anyjson.force_implementation("json")
+    except ImportError:
+        return
+
+    assert "foo" in anyjson.loads(u'{"foo": "bar"}')
Files old/anyjson-0.3.1/tests/test_implementations.pyc and 
new/anyjson-0.3.3/tests/test_implementations.pyc differ

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to