Mercurial > hg-stable
changeset 18379:e0c4f4ba624c
tests: fix doctest stability over Python versions
pprint ain't pretty in Python 2.4:
Changed in version 2.5: Dictionaries are sorted by key before the display is
computed; before 2.5, a dictionary was sorted only if its display required more
than one line, although that wasn’t documented.
Fixes issue introduced in 404feac78b8a.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 15 Jan 2013 18:42:04 +0100 |
parents | 404feac78b8a |
children | a4d7fd7ad1f7 |
files | mercurial/changelog.py |
diffstat | 1 files changed, 7 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 18:42:04 2013 +0100 @@ -27,12 +27,13 @@ def decodeextra(text): """ - >>> 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'} + >>> sorted(decodeextra(encodeextra({'foo': 'bar', 'baz': chr(0) + '2'}) + ... ).iteritems()) + [('baz', '\\x002'), ('branch', 'default'), ('foo', 'bar')] + >>> sorted(decodeextra(encodeextra({'foo': 'bar', + ... 'baz': chr(92) + chr(0) + '2'}) + ... ).iteritems()) + [('baz', '\\\\\\x002'), ('branch', 'default'), ('foo', 'bar')] """ extra = _defaultextra.copy() for l in text.split('\0'):