[pypy-commit] pypy merge-2.7.2: fix JSON tests

alex_gaynor noreply at buildbot.pypy.org
Sun Jan 22 18:53:27 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: merge-2.7.2
Changeset: r51648:e5417ef18814
Date: 2012-01-22 11:53 -0600
http://bitbucket.org/pypy/pypy/changeset/e5417ef18814/

Log:	fix JSON tests

diff --git a/lib-python/modified-2.7/json/tests/test_decode.py b/lib-python/modified-2.7/json/tests/test_decode.py
--- a/lib-python/modified-2.7/json/tests/test_decode.py
+++ b/lib-python/modified-2.7/json/tests/test_decode.py
@@ -23,12 +23,10 @@
         self.assertEqual(rval, {"key":"value", "k":"v"})
 
     def test_empty_objects(self):
-        s = '{}'
-        self.assertEqual(json.loads(s), eval(s))
-        s = '[]'
-        self.assertEqual(json.loads(s), eval(s))
-        s = '""'
-        self.assertEqual(json.loads(s), eval(s))
+        self.assertEqual(self.loads('{}'), {})
+        self.assertEqual(self.loads('[]'), [])
+        self.assertEqual(self.loads('""'), u"")
+        self.assertIsInstance(self.loads('""'), unicode)
 
     def test_object_pairs_hook(self):
         s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
diff --git a/lib-python/modified-2.7/json/tests/test_unicode.py b/lib-python/modified-2.7/json/tests/test_unicode.py
--- a/lib-python/modified-2.7/json/tests/test_unicode.py
+++ b/lib-python/modified-2.7/json/tests/test_unicode.py
@@ -81,9 +81,9 @@
         self.assertEqual(type(self.loads('"foo"')), unicode)
 
     def test_encode_not_utf_8(self):
-        self.assertEqual(json.dumps('\xb1\xe6', encoding='iso8859-2'),
+        self.assertEqual(self.dumps('\xb1\xe6', encoding='iso8859-2'),
                          '"\\u0105\\u0107"')
-        self.assertEqual(json.dumps(['\xb1\xe6'], encoding='iso8859-2'),
+        self.assertEqual(self.dumps(['\xb1\xe6'], encoding='iso8859-2'),
                          '["\\u0105\\u0107"]')
 
 


More information about the pypy-commit mailing list