Closed christophe-david closed 1 year ago
Describe the bug Methods like DataFile.from_dataframe() or DataFile.from_ivc() return a VariableList instance instead of a DataFile instance.
To Reproduce
import fastoad.api as oad import openmdao.api as om ivc = om.IndepVarComp("my_var") result = oad.DataFile.from_ivc(ivc) print(type(result))
returns
<class 'fastoad.openmdao.variables.variable_list.VariableList'>
Expected behavior The snippet above should return <class 'fastoad.io.variable_io.DataFile'>. More generally, any subclass of VariableList should return an instance of the subclass when using this methods.
<class 'fastoad.io.variable_io.DataFile'>
VariableList
The fix is not complete. The problem still stands for DataFile.from_problem(). The problem comes from the __add__ magic method of VariableList.
DataFile.from_problem()
__add__
Describe the bug Methods like DataFile.from_dataframe() or DataFile.from_ivc() return a VariableList instance instead of a DataFile instance.
To Reproduce
returns
Expected behavior The snippet above should return
<class 'fastoad.io.variable_io.DataFile'>
. More generally, any subclass ofVariableList
should return an instance of the subclass when using this methods.