r""" Test _fit_nnls for supported cases of failure
()
| 394 | |
| 395 | |
| 396 | def test_fitting_admm_fail(): |
| 397 | r""" |
| 398 | Test _fit_nnls for supported cases of failure |
| 399 | """ |
| 400 | n_pts, n_refs, n_pixels = 10, 3, 5 |
| 401 | |
| 402 | spectra = np.zeros(shape=[n_pts]) # 1D instead of 2D |
| 403 | data_input = np.zeros(shape=[n_pts, n_refs]) |
| 404 | with pytest.raises(AssertionError, match="Data array 'data' must have 2 dimensions"): |
| 405 | _fitting_admm(spectra, data_input) |
| 406 | |
| 407 | spectra = np.zeros(shape=[n_pts, n_pixels]) |
| 408 | data_input = np.zeros(shape=[n_pts]) # 1D instead of 2D |
| 409 | with pytest.raises(AssertionError, match="Data array 'ref_spectra' must have 2 dimensions"): |
| 410 | _fitting_admm(spectra, data_input) |
| 411 | |
| 412 | spectra = np.zeros(shape=[n_pts - 1, n_pixels]) # Wrong number of data points |
| 413 | data_input = np.zeros(shape=[n_pts, n_refs]) |
| 414 | with pytest.raises(AssertionError, match="number of spectrum points in data .+ do not match"): |
| 415 | _fitting_admm(spectra, data_input) |
| 416 | |
| 417 | |
| 418 | # fmt: off |
nothing calls this directly
no test coverage detected