Skip to content

Commit

Permalink
Fix example to work with Python < 3.6
Browse files Browse the repository at this point in the history
Before Python 3.6, `dict`s where ordered randomly, so the tests can't
reliably predict the output. That's why I had to rewrite these tests in
such a weird way, because testing equality on `dict`s doesn't take order
into account.
  • Loading branch information
gnn committed Dec 10, 2018
1 parent 4d697a4 commit e6713d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/oemof/tabular/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def remap(mapping, renamings, selection):
--------
>>> renamings = {'R1': {'zero': 'nada'}, 'R2': {'foo': 'bar'}}
>>> mapping = {'zero': 0, 'foo': 'foobar'}
>>> remap(mapping, renamings, 'R1')
{'nada': 0, 'foo': 'foobar'}
>>> remap(mapping, renamings, 'R2')
{'bar': 'foobar', 'zero': 0}
>>> remap(mapping, renamings, 'R1') == {'nada': 0, 'foo': 'foobar'}
True
>>> remap(mapping, renamings, 'R2') == {'zero': 0, 'bar': 'foobar'}
True
As a special case, if `selection` is a `class`, not only `selection` is
considered to select a renaming, but the classes in `selection`'s `mro` are
Expand Down

0 comments on commit e6713d3

Please sign in to comment.