From d034e1de9c8fe166f38624ee872b8bc46643c66a Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 23 Nov 2022 21:23:36 -0600 Subject: [PATCH] Apply suggestions from code review Incorporating suggestions from @paulromano Co-authored-by: Paul Romano --- openmc/geometry.py | 2 +- openmc/model/model.py | 6 ++---- tests/regression_tests/model_xml/test.py | 16 ++++++++-------- tests/unit_tests/test_model.py | 2 -- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/openmc/geometry.py b/openmc/geometry.py index 57aab1884..630106628 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -256,7 +256,7 @@ class Geometry: ---------- path : str, optional Path to geometry XML file - materials : dict + materials : dict Dictionary mapping material ID strings to :class:`openmc.Material` instances (defined in :math:`openmc.Geometry.from_xml`) diff --git a/openmc/model/model.py b/openmc/model/model.py index cb84f2c17..559def570 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -228,8 +228,7 @@ class Model: model.settings = openmc.Settings.from_xml_element(root.find('settings')) model.materials = openmc.Materials.from_xml_element(root.find('materials')) materials = {str(m.id): m for m in model.materials} - model.geometry = \ - openmc.Geometry.from_xml_element(root.find('geometry'), materials) + model.geometry = .Geometry.from_xml_element(root.find('geometry'), materials) # gather meshses from other classes before reading the tally node meshes = {} @@ -542,8 +541,7 @@ class Model: materials = openmc.Materials(self.geometry.get_all_materials() .values()) - with open(d, 'w', encoding='utf-8', - errors='xmlcharrefreplace') as fh: + with open(d, 'w', encoding='utf-8', errors='xmlcharrefreplace') as fh: # write the XML header fh.write("\n") fh.write("\n") diff --git a/tests/regression_tests/model_xml/test.py b/tests/regression_tests/model_xml/test.py index 448079b3f..289bd4655 100644 --- a/tests/regression_tests/model_xml/test.py +++ b/tests/regression_tests/model_xml/test.py @@ -55,16 +55,16 @@ class ModelXMLTestHarness(PyAPITestHarness): models = [ -'adj_cell_rotation_model', -'lattice_mult_model', -'energy_laws_model', -'photon_prod_model' + 'adj_cell_rotation_model', + 'lattice_mult_model', + 'energy_laws_model', + 'photon_prod_model' ] paths = [ -'../adj_cell_rotation', -'../lattice_multiple', -'../energy_laws', -'../photon_production' + '../adj_cell_rotation', + '../lattice_multiple', + '../energy_laws', + '../photon_production' ] diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index ce81b00ee..928bf0715 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -7,8 +7,6 @@ import pytest import openmc import openmc.lib -from .. import cdtemp - @pytest.fixture(scope='function') def pin_model_attributes():