@@ -232,7 +232,7 @@ def testResidual(self):
232232
233233 # Now try some restraints. We want c to be exactly zero. It should give
234234 # a penalty of (c-0)**2, which is 4 in this case
235- r1 = self .recipe .restrain (self .fitcontribution .c , 0 , 0 , 1 )
235+ r1 = self .recipe .add_restraint (self .fitcontribution .c , 0 , 0 , 1 )
236236 self .recipe ._ready = False
237237 res = self .recipe .residual ()
238238 chi2 = 4 + dot (y - self .profile .y , y - self .profile .y )
@@ -263,7 +263,9 @@ def testResidual(self):
263263 self .assertTrue (array_equal (y - self .profile .y , res ))
264264
265265 # Add a restraint at the fitcontribution level.
266- r1 = self .fitcontribution .restrain (self .fitcontribution .c , 0 , 0 , 1 )
266+ r1 = self .fitcontribution .add_restraint (
267+ self .fitcontribution .c , 0 , 0 , 1
268+ )
267269 self .recipe ._ready = False
268270 # The chi2 is the same as above, plus 4
269271 res = self .recipe .residual ()
@@ -361,7 +363,7 @@ def testPrintFitHook(capturestdout):
361363 recipe .addContribution (fitcontribution )
362364
363365 recipe .add_variable (fitcontribution .c )
364- recipe .restrain ("c" , lb = 5 )
366+ recipe .add_restraint ("c" , lb = 5 )
365367 (pfh ,) = recipe .getFitHooks ()
366368 out = capturestdout (recipe .scalar_residual )
367369 assert "" == out
@@ -437,7 +439,7 @@ def test_add_contribution(capturestdout):
437439 recipe .add_contribution (fitcontribution )
438440
439441 recipe .add_variable (fitcontribution .c )
440- recipe .restrain ("c" , lb = 5 )
442+ recipe .add_restraint ("c" , lb = 5 )
441443 (pfh ,) = recipe .get_fit_hooks ()
442444 out = capturestdout (recipe .scalar_residual )
443445 assert "" == out
0 commit comments