diff --git a/tests/test_evolve.py b/tests/test_evolve.py index 51621062..1815654d 100644 --- a/tests/test_evolve.py +++ b/tests/test_evolve.py @@ -50,22 +50,22 @@ def test_write_operator_card_q0(tmp_path): """Checks https://github.com/NNPDF/pineko/issues/146""" p = tmp_path / "q0.yaml" g = FakePine() - # 1. defaults t = copy.deepcopy(default_card) o = copy.deepcopy(example.raw_operator()) + # 1. Same Q0 and mu0, all ok + t["Q0"] = 5.0 + o["mu0"] = 5.0 _xs, _mu2s = pineko.evolve.write_operator_card(g, o, p, t) with open(p, encoding="utf8") as f: oo = yaml.safe_load(f) np.testing.assert_allclose(oo["mu0"], t["Q0"]) - # 2. overwriting from theory side - t["Q0"] = 10.0 + # 2. Q0 only in theory, all ok + o.pop("mu0") _xs, _mu2s = pineko.evolve.write_operator_card(g, o, p, t) with open(p, encoding="utf8") as f: oo = yaml.safe_load(f) np.testing.assert_allclose(oo["mu0"], t["Q0"]) - # 3. op template is ignored + # 3. op is different, raises error o["mu0"] = 11.0 - _xs, _mu2s = pineko.evolve.write_operator_card(g, o, p, t) - with open(p, encoding="utf8") as f: - oo = yaml.safe_load(f) - np.testing.assert_allclose(oo["mu0"], t["Q0"]) + with pytest.raises(ValueError): + _xs, _mu2s = pineko.evolve.write_operator_card(g, o, p, t)