def test_Param(): values = 3, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None p = util.Param(*values) with PrintAssert("Param(...)") as pr: p._repr_pretty_(pr, True) with PrintAssert(tx.params([p])) as pr: p._repr_pretty_(pr, False)
def test_text_params_with_limits(): m = Minuit( f1, x=3, y=5, ) m.fixed["x"] = True m.errors = (0.2, 0.1) m.limits = ((0, None), (0, 10)) assert _repr_text.params(m.params) == ref("params_with_limits")
def test_Params(): p = util.Params([ util.Param(3, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None) ]) with PrintAssert("Params(...)") as pr: p._repr_pretty_(pr, True) with PrintAssert(tx.params(p)) as pr: p._repr_pretty_(pr, False)
def test_Minuit(): m = Minuit(sphere_np, (0, 0)) with PrintAssert("<Minuit ...>") as pr: m._repr_pretty_(pr, True) with PrintAssert(tx.params(m.params)) as pr: m._repr_pretty_(pr, False) m.migrad() expected = (tx.fmin(m.fmin) + "\n" + tx.params(m.params) + "\n" + tx.matrix(m.covariance)) with PrintAssert(expected) as pr: m._repr_pretty_(pr, False) m.minos() expected = (tx.fmin(m.fmin) + "\n" + tx.params(m.params) + "\n" + tx.merrors(m.merrors) + "\n" + tx.matrix(m.covariance)) with PrintAssert(expected) as pr: m._repr_pretty_(pr, False)
def test_text_params_difficult_values(): mps = [ Param( 0, "x", -1.234567e-22, 1.234567e-11, None, True, False, False, False, False, None, None, ) ] assert _repr_text.params(mps) == ref("params_difficult_values")
def test_text_params_with_long_names(): mps = [ Param( 0, "super-long-name", 0, 0, None, False, False, False, False, False, None, None, ) ] assert _repr_text.params(mps) == ref("params_long_names")
def test_text_params(minuit): assert _repr_text.params(minuit.params) == ref("params")