added test to check dagmc name is in xml (#3657)

This commit is contained in:
Jonathan Shimwell 2025-11-27 17:03:38 +01:00 committed by GitHub
parent 27e38e8946
commit dcb7443711
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -302,6 +302,8 @@ class DAGMCUniverse(openmc.UniverseBase):
dagmc_element = ET.Element('dagmc_universe')
dagmc_element.set('id', str(self.id))
if self.name:
dagmc_element.set('name', self.name)
if self.auto_geom_ids:
dagmc_element.set('auto_geom_ids', 'true')
if self.auto_mat_ids:

View file

@ -31,7 +31,7 @@ def model(request):
p = Path(request.fspath).parent / "dagmc.h5m"
daguniv = openmc.DAGMCUniverse(p, auto_geom_ids=True)
daguniv = openmc.DAGMCUniverse(p, name='simple-dagmc', auto_geom_ids=True)
lattice = openmc.RectLattice()
lattice.dimension = [2, 2]
@ -232,6 +232,7 @@ def test_dagmc_xml(model):
dagmc_ele = root.find('dagmc_universe')
assert dagmc_ele.get('id') == str(dag_univ.id)
assert dagmc_ele.get('name') == str(dag_univ.name)
assert dagmc_ele.get('filename') == str(dag_univ.filename)
assert dagmc_ele.get('auto_geom_ids') == str(dag_univ.auto_geom_ids).lower()