tests: stabilize doctest output
Avoid dependencies to dict iteration order.
--- 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