Commit 45e95439 authored by Akim Demaille's avatar Akim Demaille
Browse files

python: sort the info dictonary

To match the fact that dictionaries are sorted in Python 3.7, IPython
no longer sort the dictionaries when displaying
them (https://github.com/ipython/ipython/issues/10110).

So build them in the sorted order, so that our notebook tests produce
the expected output.
parent f4cbaa83
......@@ -23,7 +23,14 @@ def _info_to_dict(info):
Convert Booleans into bool, and likewise for integers.
'''
res = {}
for l in info.splitlines():
# Since Python 3.7, dictionaries are guaranteed to preserve the
# order. So let's use a nice one.
#
# We used to rely on IPython displaying dictionaries in order in
# our test-suite (doc/notebooks), but with Python 3.7, IPython no
# longer sorts the dictionaries. Sorting here although makes it
# easier for our tests.
for l in sorted(info.splitlines()):
k, v = l.split(':', 1)
v = v.strip()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment