From 1a7aee088c1034672a1421ded00146dffc55d626 Mon Sep 17 00:00:00 2001 From: Alexander Held Date: Thu, 11 May 2023 11:02:54 -0400 Subject: [PATCH] add test --- tests/test_pdf.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 045575d725..75b7957757 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -1329,3 +1329,34 @@ def test_is_shared_paramset_shapesys_same_sample_same_channel(): with pytest.raises(pyhf.exceptions.InvalidModel): pyhf.Workspace(spec).model() + + +def test_shapefactor_as_poi(): + spec = { + "channels": [ + { + "name": "SR", + "samples": [ + { + "data": [5.0, 10.0], + "modifiers": [ + {"data": None, "name": "mu", "type": "shapefactor"} + ], + "name": "Signal", + } + ], + } + ], + "measurements": [ + {"config": {"parameters": [], "poi": "mu"}, "name": "example"} + ], + "observations": [{"data": [5.0, 10.0], "name": "SR"}], + "version": "1.0.0", + } + + with pytest.raises( + pyhf.exceptions.InvalidModel, + match="The parameter 'mu' is of type 'shapefactor' and thus cannot be used as " + "parameter of interest.", + ): + pyhf.Workspace(spec).model()