def test_Matrix(): m = util.Matrix(("a", "b")) m[:] = [[1, 2], [3, 4]] with PrintAssert("<Matrix ...>") as pr: m._repr_pretty_(pr, True) with PrintAssert(tx.matrix(m)) as pr: m._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_matrix_difficult_values(): m = Matrix({"x": 0, "y": 1}) m[:] = ((-1.23456, 0), (0, 0)) assert _repr_text.matrix(m) == ref("matrix_difficult_values")
def test_text_matrix_with_long_names(): m = Matrix({"super-long-name": 0, "x": 1}) m[:] = ((1.0, 0.1), (0.1, 1.0)) assert _repr_text.matrix(m) == ref("matrix_long_names")
def test_text_matrix_large(): m = Matrix({"x": 0, "y": 1, "z": 2}) m[:] = ((1, 2, 3), (4, 5, 6), (7, 8, 9)) assert _repr_text.matrix(m) == ref("matrix_large")
def test_text_matrix_mini(): m = Matrix({"x": 0}) m[:] = [1.0] assert _repr_text.matrix(m) == ref("matrix_mini")
def test_text_matrix(): m = Matrix({"x": 0, "y": 1}) m[:] = ((1.0, -0.0), (-0.0, 0.25)) assert _repr_text.matrix(m) == ref("matrix")