Skip to content

Commit 3036d1b

Browse files
committed
code inspector comments
1 parent f7fb46b commit 3036d1b

File tree

7 files changed

+22
-27
lines changed

7 files changed

+22
-27
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
# - run:
4444
# name: run test_example_neutronics_simulations
45-
# command:
45+
# command:
4646
# pytest tests/test_example_neutronics_simulations.py -v --cov=openmc_dagmc_wrapper --cov-append --cov-report term --cov-report xml
4747

4848

openmc_dagmc_wrapper/Tally.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111

1212
class Tally(openmc.Tally):
13+
"""
14+
Extends the openmc.Tally object to allow a range of standard tally_types.
15+
Facilitates standardized combinations of tally openmc.Tally.scores and
16+
openmc.Tally.filters to allow convenient application of tallies to
17+
specified materials or volumes.
18+
"""
1319
def __init__(
1420
self,
1521
tally_type,
@@ -308,6 +314,9 @@ def __init__(
308314
self.plane = plane
309315
self.mesh_resolution = mesh_resolution
310316

317+
self.bbox_from_h5 = None
318+
self.bounding_box = None
319+
311320
self.create_mesh(bounding_box)
312321

313322
super().__init__(tally_type)

openmc_dagmc_wrapper/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def process_results(
186186
}
187187
if "std. dev." in data_frame.keys():
188188
tally_std_dev = data_frame["std. dev."].sum()
189-
results[tally.name]["std. dev."] = tally_std_dev,
189+
results[tally.name]["std. dev."] = tally_std_dev
190190

191191
elif tally.name.endswith("heating"):
192192

tests/test_neutronics_utils.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414

1515
class TestNeutronicsUtilityFunctions(unittest.TestCase):
16+
"""Tests the neutronics utilities functionality and use cases"""
17+
1618
def setUp(self):
1719

1820
if not Path("tests/v0.0.2.tar.gz").is_file():
@@ -64,25 +66,6 @@ def test_create_material_as_openmc_materials(self):
6466
assert produced_mat.average_molar_mass == expected_mat.average_molar_mass
6567
assert produced_mat.nuclides == expected_mat.nuclides
6668

67-
def test_create_material_as_openmc_materials(self):
68-
mats = ["Be", "tungsten", "eurofer", "copper"]
69-
70-
for mat in mats:
71-
# build
72-
tag_mat = "mat1"
73-
nmm_mat = nmm.Material.from_library(
74-
name=mat, material_id=None
75-
)
76-
expected_mat = nmm_mat.openmc_material
77-
78-
# run
79-
produced_mat = create_material(tag_mat, nmm_mat)
80-
81-
# test
82-
assert produced_mat.density == expected_mat.density
83-
assert produced_mat.average_molar_mass == expected_mat.average_molar_mass
84-
assert produced_mat.nuclides == expected_mat.nuclides
85-
8669
def test_create_material_wrong_type(self):
8770
def incorrect_type():
8871
create_material("mat1", [1, 2, 3])

tests/test_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

22
import unittest
33

4-
import openmc
54
import openmc_dagmc_wrapper as odw
65

76

87
class TestSettings(unittest.TestCase):
8+
"""Tests the settings.py file functionality"""
9+
910
def test_fusion_settings_attributes(self):
1011
fusion_settings = odw.FusionSettings()
1112
assert fusion_settings.run_mode == "fixed source"

tests/test_tallies/test_cell_tallies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
class TestCellTallies(unittest.TestCase):
9+
"""Tests the CellTallies class functionality"""
910

1011
def test_name(self):
1112
my_tally = odw.CellTally('heating', target=1)

tests/test_tallies/test_mesh_tallies.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import urllib.request
44
from pathlib import Path
55

6-
76
import openmc
87
import openmc_dagmc_wrapper as odw
98

109

1110
class TestMeshTallies(unittest.TestCase):
11+
"""Tests the MeshTallies class functionality"""
12+
1213
def setUp(self):
1314

1415
if not Path("tests/v0.0.2.tar.gz").is_file():
@@ -26,15 +27,15 @@ def test_incorrect_mesh_tally_2d(self):
2627
"""Set a mesh_tally_2d that is not accepted which should raise an
2728
error"""
2829
def incorrect_mesh_tally_2d():
29-
my_tally = odw.MeshTally2D("coucou", plane="xy")
30+
odw.MeshTally2D("coucou", plane="xy")
3031

3132
self.assertRaises(ValueError, incorrect_mesh_tally_2d)
3233

3334
def test_incorrect_mesh_tally_2d_type(self):
3435
"""Set a mesh_tally_2d that is the wrong type which should raise an
3536
error"""
3637
def incorrect_mesh_tally_2d_type():
37-
my_tally = odw.MeshTally2D(1, plane="xy")
38+
odw.MeshTally2D(1, plane="xy")
3839

3940
self.assertRaises(TypeError, incorrect_mesh_tally_2d_type)
4041

@@ -43,7 +44,7 @@ def test_incorrect_mesh_tally_3d(self):
4344
error"""
4445

4546
def incorrect_mesh_tally_3d():
46-
my_tally = odw.MeshTally3D("coucou")
47+
odw.MeshTally3D("coucou")
4748

4849
self.assertRaises(ValueError, incorrect_mesh_tally_3d)
4950

@@ -52,7 +53,7 @@ def test_incorrect_mesh_tally_3d_type(self):
5253
error"""
5354

5455
def incorrect_mesh_tally_3d_type():
55-
my_tally = odw.MeshTally3D(1)
56+
odw.MeshTally3D(1)
5657

5758
self.assertRaises(TypeError, incorrect_mesh_tally_3d_type)
5859

0 commit comments

Comments
 (0)