fandango.objects.Struct initializer arguments order
For python3 test test_objects.py::test_Struct
is failing, bt for python2 it passses. In fact - the behavior of Struct.__init__
function is dependant on python version and the order of the arguments is not guaranteed.
Consider this code:
from fandango.objects import Struct
s = Struct(key1="val1", key2="val2")
print(s.keys())
On python 2 it will give [key2, key1]
but on python 3 [key1, key2]
. I don't know what is the logic behind using fandangos Struct, but if it needs to remember the order, the code have to be refactored for py3. Otherwise, if the order doesnt matter, lets go with:
assert set(test_s.keys()) == set(["model", "unit_prefix", "unit", "value", "name"])
instead of:
assert list(test_s.keys()) == ["model", "unit_prefix", "unit", "value", "name"]
in our tests.