@@ -376,12 +376,14 @@ def test__goodness_of_fit(
376
376
assert np .allclose (p_val , 0.91926079 )
377
377
caplog .clear ()
378
378
379
- # same setup but using custom auxdata
379
+ # same setup but using custom auxdata and custom fixed parameters
380
380
model , _ = model_utils .model_and_data (example_spec_multibin )
381
381
data = [35 , 8 , 10 ] + [0.9 , 1.1 , 0.8 ] # custom aux
382
- p_val = fit ._goodness_of_fit (model , data , 9.964913 )
382
+ fix_pars = [False , False , False , True ] # custom fixed
383
+ p_val = fit ._goodness_of_fit (model , data , 9.964913 , fix_pars = fix_pars )
383
384
assert mock_pars .call_count == 2
384
385
assert np .allclose (mock_pars .call_args [0 ][1 ], [0.9 , 1.1 , 0.8 ]) # aux picked up
386
+ assert mock_count .call_args [1 ] == {"fix_pars" : fix_pars } # fixed pars picked up
385
387
assert np .allclose (p_val , 0.91926079 ) # same result as before
386
388
387
389
# no auxdata and zero degrees of freedom in chi2 test
@@ -501,9 +503,9 @@ def test_fit(mock_fit, mock_print, mock_gof):
501
503
assert fit_results .bestfit == [1.0 ]
502
504
503
505
# goodness-of-fit test
504
- fit_results_gof = fit .fit (model , data , goodness_of_fit = True )
506
+ fit_results_gof = fit .fit (model , data , goodness_of_fit = True , fix_pars = fix_pars )
505
507
assert mock_gof .call_args [0 ] == (model , data , 2.0 )
506
- assert mock_gof .call_args [1 ] == {"fix_pars" : None }
508
+ assert mock_gof .call_args [1 ] == {"fix_pars" : fix_pars }
507
509
assert fit_results_gof .goodness_of_fit == 0.1
508
510
509
511
0 commit comments