Skip to content

Commit 368f34f

Browse files
committed
Fix EraseAllParamSet binding for compiled RefinableObj
1 parent 2ba95d6 commit 368f34f

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

‎src/extensions/refinableobj_ext.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ RefinablePar& _GetParNotFixedLong(RefinableObj& obj, const long i)
8585
return obj.GetParNotFixed(i);
8686
}
8787

88+
void _EraseAllParamSet(RefinableObj& obj)
89+
{
90+
obj.EraseAllParamSet();
91+
}
92+
8893

8994
class RefinableObjWrap : public RefinableObj,
9095
public wrapper<RefinableObj>
@@ -103,11 +108,6 @@ class RefinableObjWrap : public RefinableObj,
103108
RefinableObj::SetDeleteRefParInDestructor(false);
104109
}
105110

106-
// Fix for const void issue
107-
void EraseAllParamSet() {
108-
this->RefinableObj::EraseAllParamSet();
109-
}
110-
111111
const std::string& default_GetClassName() const
112112
{ return this->RefinableObj::GetClassName(); }
113113

@@ -484,7 +484,7 @@ void wrap_refinableobj()
484484
return_value_policy<copy_const_reference>())
485485
.def("GetParamSet_ParNotFixedHumanValue",
486486
&RefinableObj::GetParamSet_ParNotFixedHumanValue)
487-
.def("EraseAllParamSet", &RefinableObjWrap::EraseAllParamSet)
487+
.def("EraseAllParamSet", &_EraseAllParamSet)
488488
.def("GetParamSetName", &RefinableObj::GetParamSetName,
489489
return_value_policy<copy_const_reference>())
490490
.def("SetLimitsAbsolute", ( void (RefinableObj::*)

‎tests/test_lsq.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import pytest
1515

16-
from pyobjcryst import refinableobj
16+
from pyobjcryst import ObjCrystException, refinableobj
1717
from pyobjcryst.diffractiondatasinglecrystal import (
1818
DiffractionDataSingleCrystal,
1919
)
@@ -56,6 +56,16 @@ def test_lsq_get_refined_obj(self):
5656
lsq.PrepareRefParList()
5757
# print(lsq.GetCompiledRefinedObj())
5858

59+
def test_lsq_compiled_refined_obj_erase_all_param_set(self):
60+
"""Check parameter sets can be erased on compiled refined objects."""
61+
lsq = LSQ()
62+
lsq.SetRefinedObj(self.d, 0, True, True)
63+
lsq.PrepareRefParList()
64+
refobj = lsq.GetCompiledRefinedObj()
65+
save = refobj.CreateParamSet("save")
66+
refobj.EraseAllParamSet()
67+
self.assertRaises(ObjCrystException, refobj.SaveParamSet, save)
68+
5969
def test_lsq_set_pr_fixed(self):
6070
"""Check Creating a basic LSQ object & get obs&calc arrays."""
6171
lsq = LSQ()

0 commit comments

Comments
 (0)