Skip to content

Commit

Permalink
add missing test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kratsg committed Mar 4, 2020
1 parent 9c69fb5 commit 2f828d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pyhf/infer/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(self, data, pdf, init_pars=None, par_bounds=None, qtilde=False):
self.init_pars = init_pars or pdf.config.suggested_init()
self.par_bounds = par_bounds or pdf.config.suggested_bounds()
self.qtilde = qtilde
self.sqrtqmuA_v = None

def distributions(self, poi_test):
"""
Expand Down
9 changes: 9 additions & 0 deletions tests/test_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,12 @@ def logpdf(self, pars, data):
)

assert np.isclose(cls[0], 0.7267836451638846)


@pytest.mark.parametrize("qtilde", [True, False])
def test_calculator_distributions_without_teststatistic(qtilde):
calc = pyhf.infer.AsymptoticCalculator(
[0.0], {}, [1.0], [(0.0, 10.0)], qtilde=qtilde
)
with pytest.raises(RuntimeError):
calc.distributions(1.0)

0 comments on commit 2f828d3

Please sign in to comment.