def test_dict_conversion(): param_orig = Parameter(name='temperature') param_dict = param_orig.to_dict() param_dict['low'] = 0. param_dict['high'] = 273. param_conv = Parameter().from_dict(param_dict) assert param_conv.low == param_dict['low'] assert param_conv.high == param_dict['high'] assert param_conv.name == param_orig.name
def test_abstract_parameter_dict_conversion(name, param_type, low, high): param_orig = Parameter(name = name, type = param_type, low = low, high = high) param_dict = param_orig.to_dict() param_conv = Parameter().from_dict(param_dict) for attr in ['name', 'type', 'low', 'high']: assert param_conv.get(attr) == param_orig.get(attr)