@@ -297,6 +297,40 @@ def testResidual(self):
297297
298298
299299# ----------------------------------------------------------------------------
300+ def test_boundsToRestraints ():
301+ recipe = FitRecipe ("recipe" )
302+
303+ # create a bounded variable
304+ recipe .create_new_variable ("var1" , 1 )
305+ recipe .var1 .bounds = (- 1 , 1 )
306+
307+ # apply restraints from bounds
308+ recipe .boundsToRestraints (sig = 2 , scaled = True )
309+ restraints = list (recipe ._restraints )
310+ assert len (restraints ) == 1
311+ r = restraints [0 ]
312+ assert r .lb == - 1
313+ assert r .ub == 1
314+ assert r .sig == 2
315+ assert r .scaled is True
316+
317+
318+ def test_convert_bounds_to_restraints ():
319+ recipe = FitRecipe ("recipe" )
320+ # create a bounded variable
321+ recipe .create_new_variable ("var1" , 1 )
322+ recipe .var1 .bounds = (- 1 , 1 )
323+ # apply restraints from bounds
324+ recipe .convert_bounds_to_restraints (sig = 2 , scaled = True )
325+ restraints = list (recipe ._restraints )
326+ assert len (restraints ) == 1
327+ r = restraints [0 ]
328+ assert r .lb == - 1
329+ assert r .ub == 1
330+ assert r .sig == 2
331+ assert r .scaled is True
332+
333+
300334def testPrintFitHook (capturestdout ):
301335 "check output from default PrintFitHook."
302336 recipe = FitRecipe ("recipe" )
0 commit comments