# HG changeset patch # User Mads Kiilerich <m...@kiilerich.com> # Date 1687853351 -7200 # Tue Jun 27 10:09:11 2023 +0200 # Branch stable # Node ID 27c7a6d21b9dae4d465a569480331d2467b423f2 # Parent ec46e9b39b2a6f5d0c59aa803e2eb5d9dfc44cc3 tests: fix sortdict doctest with Python 3.12
The output of OrderedDict changed to use plain dict syntax: $ python3.11 -c "import collections;print(collections.OrderedDict([('a', 0), ('b', 1)]))" OrderedDict([('a', 0), ('b', 1)]) $ python3.12 -c "import collections;print(collections.OrderedDict([('a', 0), ('b', 1)]))" OrderedDict({'a': 0, 'b': 1}) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1277,14 +1277,14 @@ class sortdict(collections.OrderedDict): >>> d1 = sortdict([(b'a', 0), (b'b', 1)]) >>> d2 = d1.copy() - >>> d2 - sortdict([('a', 0), ('b', 1)]) + >>> list(d2.items()) + [('a', 0), ('b', 1)] >>> d2.update([(b'a', 2)]) >>> list(d2.keys()) # should still be in last-set order ['b', 'a'] >>> d1.insert(1, b'a.5', 0.5) - >>> d1 - sortdict([('a', 0), ('a.5', 0.5), ('b', 1)]) + >>> list(d1.items()) + [('a', 0), ('a.5', 0.5), ('b', 1)] """ def __setitem__(self, key, value): _______________________________________________ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel