Skip to content

Commit

Permalink
Updated ModelDescription class to ensure that options data memmber is…
Browse files Browse the repository at this point in the history
… OrderedDict,

not plain dict (ensures unit tests work the same across Python 3.5--3.7).
  • Loading branch information
perwin committed Jul 19, 2019
1 parent fcd682b commit e1845a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyimfit/descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ class ModelDescription(object):
"""

def __init__( self, functionSetsList=None, options={} ):
self.options = {}
self.options = OrderedDict()
self.options.update(options)
self._functionSets = []
self.nFunctionSets = 0
Expand Down
3 changes: 1 addition & 2 deletions pyimfit/tests/test_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,10 @@ def test_ModelDescription_getStrings(self):

def test_ModelDescription_getStrings_with_options(self):
modeldesc = ModelDescription.load(CONFIG_EXAMPLE_EXPONENTIAL)
# use OrderedDict to ensure options are entered in same order on Mac and Linux
# use OrderedDict to ensure options are entered in same order across different versions of Python
optionsDict = OrderedDict()
optionsDict["GAIN"] = 4.5
optionsDict["READNOISE"] = 0.9
# optionsDict = {"GAIN": 4.5, "READNOISE": 0.9}
modeldesc.updateOptions(optionsDict)

lines_correct = ["GAIN\t\t4.5\n", "READNOISE\t\t0.9\n", "\n",
Expand Down

0 comments on commit e1845a9

Please sign in to comment.