Skip to content

Commit fffb48e

Browse files
authored
Adding test crumbs to nuclearDataIO (#1512)
1 parent d3b5bd5 commit fffb48e

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

Diff for: armi/nuclearDataIO/cccc/tests/test_isotxs.py

+35
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""Tests the workings of the library wrappers."""
15+
import filecmp
1516
import unittest
1617

1718
from armi import nuclearDataIO
1819
from armi.nucDirectory import nuclideBases
1920
from armi.nuclearDataIO import xsLibraries
2021
from armi.nuclearDataIO.cccc import isotxs
2122
from armi.tests import ISOAA_PATH
23+
from armi.utils.directoryChangers import TemporaryDirectoryChanger
2224

2325

2426
class TestIsotxs(unittest.TestCase):
@@ -30,6 +32,33 @@ def setUpClass(cls):
3032
# be a small library with LFPs, Actinides, structure, and coolant
3133
cls.lib = isotxs.readBinary(ISOAA_PATH)
3234

35+
def test_writeBinary(self):
36+
"""Test reading in an ISOTXS file, and then writing it back out again.
37+
38+
Now, the library here can't guarantee the output will be the same as the
39+
input. But we can guarantee the written file is still valid, by reading
40+
it again.
41+
42+
.. test:: Write ISOTSX binary files.
43+
:id: T_ARMI_NUCDATA_ISOTXS0
44+
:tests: R_ARMI_NUCDATA_ISOTXS
45+
"""
46+
with TemporaryDirectoryChanger():
47+
origLib = isotxs.readBinary(ISOAA_PATH)
48+
49+
fname = self._testMethodName + "temp-aa.isotxs"
50+
isotxs.writeBinary(origLib, fname)
51+
lib = isotxs.readBinary(fname)
52+
53+
# validate the written file is still valid
54+
nucs = lib.nuclides
55+
self.assertTrue(nucs)
56+
self.assertIn("AA", lib.xsIDs)
57+
nuc = lib["U235AA"]
58+
self.assertIsNotNone(nuc)
59+
with self.assertRaises(KeyError):
60+
lib.getNuclide("nonexistent", "zz")
61+
3362
def test_isotxsGeneralData(self):
3463
nucs = self.lib.nuclides
3564
self.assertTrue(nucs)
@@ -164,6 +193,12 @@ def test_getGAMISOFileName(self):
164193

165194
class Isotxs_merge_Tests(unittest.TestCase):
166195
def test_mergeMccV2FilesRemovesTheFileWideChi(self):
196+
"""Test merging ISOTXS files.
197+
198+
.. test:: Read ISOTXS files.
199+
:id: T_ARMI_NUCDATA_ISOTXS1
200+
:tests: R_ARMI_NUCDATA_ISOTXS
201+
"""
167202
isoaa = isotxs.readBinary(ISOAA_PATH)
168203
self.assertAlmostEqual(1.0, sum(isoaa.isotxsMetadata["chi"]), 5)
169204
self.assertAlmostEqual(1, isoaa.isotxsMetadata["fileWideChiFlag"])

Diff for: armi/nuclearDataIO/cccc/tests/test_pmatrx.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ class TestProductionMatrix_FromWritten(TestPmatrx):
201201
"""
202202

203203
def test_writtenIsIdenticalToOriginal(self):
204-
"""Make sure our writer produces something identical to the original."""
204+
"""Make sure our writer produces something identical to the original.
205+
206+
.. test:: Test reading and writing PMATRIX files.
207+
:id: T_ARMI_NUCDATA_PMATRX
208+
:tests: R_ARMI_NUCDATA_PMATRX
209+
"""
205210
origLib = pmatrx.readBinary(test_xsLibraries.PMATRX_AA)
206211

207212
fname = self._testMethodName + "temp-aa.pmatrx"

Diff for: armi/nuclearDataIO/tests/test_xsCollections.py

+6
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ def test_plotNucXs(self):
7878
self.assertTrue(os.path.exists(fName))
7979

8080
def test_createMacrosFromMicros(self):
81+
"""Test calculating macroscopic cross sections from microscopic cross sections.
82+
83+
.. test:: Compute macroscopic cross sections from microscopic cross sections and number densities.
84+
:id: T_ARMI_NUCDATA_MACRO
85+
:tests: R_ARMI_NUCDATA_MACRO
86+
"""
8187
self.assertEqual(self.mc.minimumNuclideDensity, 1e-13)
8288
self.mc.createMacrosFromMicros(self.microLib, self.block)
8389
totalMacroFissionXs = 0.0

Diff for: armi/nuclearDataIO/xsCollections.py

-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ def createMacrosFromMicros(
415415
-------
416416
macros : xsCollection.XSCollection
417417
A new XSCollection full of macroscopic cross sections
418-
419418
"""
420419
runLog.debug("Building macroscopic cross sections for {0}".format(block))
421420
if nucNames is None:

Diff for: armi/reactor/converters/tests/test_axialExpansionChanger.py

+4
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ def test_coldAssemblyExpansion(self):
857857
:id: T_ARMI_ASSEM_HEIGHT_PRES
858858
:tests: R_ARMI_ASSEM_HEIGHT_PRES
859859
860+
.. test:: Axial expansion can be prescribed in blueprints for core constuction.
861+
:id: T_ARMI_INP_COLD_HEIGHT
862+
:tests: R_ARMI_INP_COLD_HEIGHT
863+
860864
Notes
861865
-----
862866
Two assertions here:

0 commit comments

Comments
 (0)