Add tests for from_xml methods

This commit is contained in:
Paul Romano 2018-08-17 10:35:24 -05:00
parent f42a75a9e1
commit c5632794de
4 changed files with 96 additions and 8 deletions

View file

@ -244,3 +244,14 @@ def test_determine_paths(cell_with_lattice):
for i in range(4):
assert geom.get_instances(cells[0].paths[i]) == i
assert geom.get_instances(mats[-1].paths[i]) == i
def test_from_xml(run_in_tmpdir, mixed_lattice_model):
# Export model
mixed_lattice_model.export_to_xml()
# Import geometry
geom = openmc.Geometry.from_xml()
assert isinstance(geom, openmc.Geometry)
ll, ur = geom.bounding_box
assert ll == pytest.approx((-6.0, -6.0, -np.inf))
assert ur == pytest.approx((6.0, 6.0, np.inf))