changeset 18378:404feac78b8a

tests: stabilize doctest output Avoid dependencies to dict iteration order.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 15 Jan 2013 02:59:14 +0100
parents 56b805306955
children e0c4f4ba624c
files mercurial/changelog.py mercurial/encoding.py
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Tue Jan 15 02:59:14 2013 +0100
+++ b/mercurial/changelog.py	Tue Jan 15 02:59:14 2013 +0100
@@ -27,10 +27,12 @@
 
 def decodeextra(text):
     """
-    >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'}))
-    {'foo': 'bar', 'baz': '\\x002', 'branch': 'default'}
-    >>> decodeextra(encodeextra({'foo': 'bar', 'baz': chr(92) + chr(0) + '2'}))
-    {'foo': 'bar', 'baz': '\\\\\\x002', 'branch': 'default'}
+    >>> from pprint import pprint as pp
+    >>> pp(decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'})))
+    {'baz': '\\x002', 'branch': 'default', 'foo': 'bar'}
+    >>> pp(decodeextra(encodeextra({'foo': 'bar',
+    ...                             'baz': chr(92) + chr(0) + '2'})))
+    {'baz': '\\\\\\x002', 'branch': 'default', 'foo': 'bar'}
     """
     extra = _defaultextra.copy()
     for l in text.split('\0'):
--- a/mercurial/encoding.py	Tue Jan 15 02:59:14 2013 +0100
+++ b/mercurial/encoding.py	Tue Jan 15 02:59:14 2013 +0100
@@ -80,8 +80,8 @@
     'foo: \\xc3\\xa4'
     >>> u2 = 'foo: \\xc3\\xa1'
     >>> d = { l: 1, tolocal(u2): 2 }
-    >>> d # no collision
-    {'foo: ?': 1, 'foo: ?': 2}
+    >>> len(d) # no collision
+    2
     >>> 'foo: ?' in d
     False
     >>> l1 = 'foo: \\xe4' # historical latin1 fallback