[Python-checkins] cpython (2.6): Let's sort the keys so that this test passes even with random hashes.

barry.warsaw python-checkins at python.org
Tue Feb 21 16:23:49 CET 2012


http://hg.python.org/cpython/rev/04738f35e0ec
changeset:   75124:04738f35e0ec
branch:      2.6
parent:      75101:19e6e55f09f3
user:        Barry Warsaw <barry at python.org>
date:        Tue Feb 21 10:22:34 2012 -0500
summary:
  Let's sort the keys so that this test passes even with random hashes.

files:
  Lib/json/__init__.py |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py
--- a/Lib/json/__init__.py
+++ b/Lib/json/__init__.py
@@ -29,7 +29,7 @@
 Compact encoding::
 
     >>> import json
-    >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
+    >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':'))
     '[1,2,3,{"4":5,"6":7}]'
 
 Pretty printing (using repr() because of extraneous whitespace in the output)::

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list