Skip to content
Snippets Groups Projects
Commit 1583fd16 authored by Pete Peterson's avatar Pete Peterson Committed by GitHub
Browse files

Merge pull request #19992 from mantidproject/19989_python_fit_function_attribute_error

Python fit function attribute error
parents 363effd0 34baed80
No related branches found
No related tags found
No related merge requests found
......@@ -167,6 +167,7 @@ void IFunctionAdapter::setAttribute(const std::string &attName,
object value = object(handle<>(getAttributeValue(*this, attr)));
callMethod<void, std::string, object>(getSelf(), "setAttributeValue",
attName, value);
storeAttributeValue(attName, attr);
} catch (UndefinedAttributeError &) {
IFunction::setAttribute(attName, attr);
}
......
......@@ -54,6 +54,12 @@ class AttributeTest(unittest.TestCase):
self.assertAlmostEqual(res[1], 0.29960535, 7)
self.assertAlmostEqual(res[2], 0.07493335, 7)
self.assertAlmostEqual(res[3], -0.09645745, 7)
def test_set_and_get_attribute_value(self):
fun = FunctionFactory.createFunction("AttributeExample")
self.assertEqual(fun.getAttributeValue('Frequency'), 0.26)
fun.setAttributeValue('Frequency', 6.2)
self.assertEqual(fun.getAttributeValue('Frequency'), 6.2)
if __name__ == '__main__':
unittest.main()
......@@ -45,6 +45,12 @@ Python
Python Algorithms
#################
Python Fit Functions
####################
- A bug that makes it difficult to define and use attributes in python fit functions has been fixed.
|
Full list of
......@@ -52,3 +58,5 @@ Full list of
and
`Python <http://github.com/mantidproject/mantid/pulls?q=is%3Apr+milestone%3A%22Release+3.11%22+is%3Amerged+label%3A%22Component%3A+Python%22>`__
changes on GitHub
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment