You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test tests/test_general::test_model_callable_from_model_init is currently marked for skipping by pytest (this was done as part of PR #317) as its behaviour is not deterministic and therefore fails a proportion of the time. The reason for this is that the BaseModel._init_from_dict method topologically sorts the supplied expressions for the model before initialising its internal mapping. The topological sorting will almost certainly reorder the expressions before storing them. When information is returned to the user by this class, the ordering of that information is based on the order of the mapping held by BaseModel and therefore differs from the originally-supplied order. This discrepancy between supplied-order and returned-order is misleading behaviour and was highlighted as needing addressing in a review comment by @pckroon on PR #317.
BaseModel should be amended to also internally store the order in which the user supplied the arguments and this ordering should be used when returning data to the user. As stated by @pckroon, "the order in which we should return [the components] should be completely independent of what the topological order is".
The text was updated successfully, but these errors were encountered:
The dependent variables will be ordered alphabetically in the returned namedtuple()
IIRC this was decided way back when dictionaries were not yet ordered by default, so a sane-ish default was chosen we could rely upon internally. I can't really pin down where this assumption is actually used at the moment though... No failing tests is a good sign.
I wouldn't hate the change, but I'm afraid it will break too many user scripts to do without a major version increase and I'm not sure that's worth it.
Test
tests/test_general::test_model_callable_from_model_init
is currently marked for skipping by pytest (this was done as part of PR #317) as its behaviour is not deterministic and therefore fails a proportion of the time. The reason for this is that theBaseModel._init_from_dict
method topologically sorts the supplied expressions for the model before initialising its internal mapping. The topological sorting will almost certainly reorder the expressions before storing them. When information is returned to the user by this class, the ordering of that information is based on the order of the mapping held byBaseModel
and therefore differs from the originally-supplied order. This discrepancy between supplied-order and returned-order is misleading behaviour and was highlighted as needing addressing in a review comment by @pckroon on PR #317.BaseModel
should be amended to also internally store the order in which the user supplied the arguments and this ordering should be used when returning data to the user. As stated by @pckroon, "the order in which we should return [the components] should be completely independent of what the topological order is".The text was updated successfully, but these errors were encountered: