r""" Test _fit_nnls for different values of the parameter 'maxiter' (maximum number of iterations)
(dataset_params)
| 363 | ]) |
| 364 | # fmt: on |
| 365 | def test_fitting_admm_arguments(dataset_params): |
| 366 | r""" |
| 367 | Test _fit_nnls for different values of the parameter 'maxiter' (maximum number of iterations) |
| 368 | """ |
| 369 | fitting_data = DataForFittingTest(**dataset_params) |
| 370 | |
| 371 | spectra = fitting_data.spectra |
| 372 | data_input = fitting_data.data_input |
| 373 | |
| 374 | # Argument 'maxiter' |
| 375 | _fitting_admm(data_input, spectra, maxiter=10) # Valid call |
| 376 | with pytest.raises(AssertionError, match="'maxiter' is zero or negative"): |
| 377 | _fitting_admm(data_input, spectra, maxiter=0) |
| 378 | with pytest.raises(AssertionError, match="'maxiter' is zero or negative"): |
| 379 | _fitting_admm(data_input, spectra, maxiter=-5) |
| 380 | |
| 381 | # Argument 'rate' |
| 382 | _fitting_admm(data_input, spectra, rate=0.2) # Valid call |
| 383 | with pytest.raises(AssertionError, match="'rate' is zero or negative"): |
| 384 | _fitting_admm(data_input, spectra, rate=0) |
| 385 | with pytest.raises(AssertionError, match="'rate' is zero or negative"): |
| 386 | _fitting_admm(data_input, spectra, rate=-0.2) |
| 387 | |
| 388 | # Argument 'epsilon' |
| 389 | _fitting_admm(data_input, spectra, epsilon=1e-10) # Valid call |
| 390 | with pytest.raises(AssertionError, match="'epsilon' is zero or negative"): |
| 391 | _fitting_admm(data_input, spectra, epsilon=0) |
| 392 | with pytest.raises(AssertionError, match="'epsilon' is zero or negative"): |
| 393 | _fitting_admm(data_input, spectra, epsilon=-1e-10) |
| 394 | |
| 395 | |
| 396 | def test_fitting_admm_fail(): |
nothing calls this directly
no test coverage detected