Update micro_xs regression test with update option

This commit is contained in:
Paul Romano 2022-12-27 22:43:42 -06:00
parent 956e3f4341
commit 6a790df0be

View file

@ -4,9 +4,10 @@ from pathlib import Path
import numpy as np
import pytest
import openmc
from openmc.deplete import MicroXS
from tests.regression_tests import config
CHAIN_FILE = Path(__file__).parents[2] / "chain_simple.xml"
@pytest.fixture(scope="module")
@ -46,7 +47,10 @@ def model():
def test_from_model(model):
ref_xs = MicroXS.from_csv('test_reference.csv')
test_xs = MicroXS.from_model(model, model.materials[0], CHAIN_FILE)
if config['update']:
test_xs.to_csv('test_reference.csv')
ref_xs = MicroXS.from_csv('test_reference.csv')
np.testing.assert_allclose(test_xs, ref_xs, rtol=1e-11)