Skip to content

Commit 5b3555c

Browse files
authored
Adding even more impl/test crumbs (#1473)
Added test crumbs for: - ncases - materials And added impl and test crumbs for: - database3 - snapshots - uniform mesh converter -axial expansion changer
1 parent 6603c1d commit 5b3555c

18 files changed

+293
-16
lines changed

armi/bookkeeping/db/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ def _getH5File(db):
249249
250250
All this being said, we are probably violating this already with genAuxiliaryData,
251251
but we have to start somewhere.
252+
253+
.. impl:: The ARMI output file has a language-agnostic format.
254+
:id: I_ARMI_DB_H5
255+
:implements: R_ARMI_DB_H5
252256
"""
253257
if isinstance(db, Database3):
254258
return db.h5db

armi/bookkeeping/db/database3.py

-2
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,6 @@ def packSpecialData(
14581458
``None`` with a magical value that shouldn't be encountered in realistic
14591459
scenarios.
14601460
1461-
14621461
Parameters
14631462
----------
14641463
data
@@ -1610,7 +1609,6 @@ def unpackSpecialData(data: numpy.ndarray, attrs, paramName: str) -> numpy.ndarr
16101609
An ndarray containing the closest possible representation of the data that was
16111610
originally written to the database.
16121611
1613-
16141612
See Also
16151613
--------
16161614
packSpecialData

armi/bookkeeping/db/databaseInterface.py

+4
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ def prepRestartRun(self):
222222
`startCycle` and `startNode`, having loaded the state from all cycles prior
223223
to that in the requested database.
224224
225+
.. impl:: Runs at a particular timenode can be re-instantiated for a snapshot.
226+
:id: I_ARMI_SNAPSHOT_RESTART
227+
:implements: R_ARMI_SNAPSHOT_RESTART
228+
225229
Notes
226230
-----
227231
Mixing the use of simple vs detailed cycles settings is allowed, provided

armi/bookkeeping/db/tests/test_database3.py

+11
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ def test_writeToDB(self):
9595
)
9696

9797
def test_getH5File(self):
98+
"""
99+
Get the h5 file for the database, because that file format is language-agnostic.
100+
101+
.. test:: Show the database is H5-formatted.
102+
:id: T_ARMI_DB_H5
103+
:tests: R_ARMI_DB_H5
104+
"""
98105
with self.assertRaises(TypeError):
99106
_getH5File(None)
100107

@@ -185,6 +192,10 @@ def test_prepRestartRun(self):
185192
above. In that cs, `reloadDBName` is set to 'reloadingDB.h5', `startCycle` = 1,
186193
and `startNode` = 2. The nonexistent 'reloadingDB.h5' must first be
187194
created here for this test.
195+
196+
.. test:: Runs can be restarted from a snapshot.
197+
:id: T_ARMI_SNAPSHOT_RESTART
198+
:tests: R_ARMI_SNAPSHOT_RESTART
188199
"""
189200
# first successfully call to prepRestartRun
190201
o, r = loadTestReactor(

armi/bookkeeping/snapshotInterface.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ def describeInterfaces(cs):
4242

4343

4444
class SnapshotInterface(interfaces.Interface):
45-
"""Snapshot managerial interface."""
45+
"""
46+
Snapshot managerial interface.
47+
48+
.. impl:: Save extra data to be saved from a run, at specified time nodes.
49+
:id: I_ARMI_SNAPSHOT0
50+
:implements: R_ARMI_SNAPSHOT
51+
"""
4652

4753
name = "snapshot"
4854

armi/bookkeeping/tests/test_snapshot.py

+14
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def test_interactCoupled(self, mockSnapshotRequest):
5959
self.assertTrue(mockSnapshotRequest.called)
6060

6161
def test_activeateDefaultSnapshots_30cycles2BurnSteps(self):
62+
"""
63+
Test snapshots for 30 cycles and 2 burnsteps, checking the dumpSnapshot setting.
64+
65+
.. test:: Allow extra data to be saved from a run, at specified time nodes.
66+
:id: T_ARMI_SNAPSHOT0
67+
:tests: R_ARMI_SNAPSHOT
68+
"""
6269
self.assertEqual([], self.cs["dumpSnapshot"])
6370

6471
newSettings = {}
@@ -72,6 +79,13 @@ def test_activeateDefaultSnapshots_30cycles2BurnSteps(self):
7279
self.assertEqual(["000000", "014000", "029002"], self.si.cs["dumpSnapshot"])
7380

7481
def test_activeateDefaultSnapshots_17cycles5BurnSteps(self):
82+
"""
83+
Test snapshots for 17 cycles and 5 burnsteps, checking the dumpSnapshot setting.
84+
85+
.. test:: Allow extra data to be saved from a run, at specified time nodes.
86+
:id: T_ARMI_SNAPSHOT1
87+
:tests: R_ARMI_SNAPSHOT
88+
"""
7589
self.assertEqual([], self.cs["dumpSnapshot"])
7690

7791
newSettings = {}

armi/cases/case.py

+8
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ def run(self):
336336
It also activates supervisory things like code coverage checking, profiling,
337337
or tracing, if requested by users during debugging.
338338
339+
.. impl:: The case class allows for a generic ARMI simulation.
340+
:id: I_ARMI_CASE
341+
:implements: R_ARMI_CASE
342+
339343
Notes
340344
-----
341345
Room for improvement: The coverage, profiling, etc. stuff can probably be moved
@@ -556,6 +560,10 @@ def checkInputs(self):
556560
"""
557561
Checks ARMI inputs for consistency.
558562
563+
.. impl:: Perform validity checks on case inputs.
564+
:id: I_ARMI_CASE_CHECK
565+
:implements: R_ARMI_CASE_CHECK
566+
559567
Returns
560568
-------
561569
bool

armi/cases/inputModifiers/inputModifiers.py

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class InputModifier:
3030
3131
Some subclasses are provided, but you are expected to make your own design-specific
3232
modifiers in most cases.
33+
34+
.. impl:: A generic tool to modify user inputs on multiple cases.
35+
:id: I_ARMI_CASE_MOD1
36+
:implements: R_ARMI_CASE_MOD
3337
"""
3438

3539
FAIL_IF_AFTER = ()

armi/cases/suiteBuilder.py

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class SuiteBuilder:
4545
"""
4646
Class for constructing a CaseSuite from combinations of modifications on base inputs.
4747
48+
.. impl:: A generic tool to modify user inputs on multiple cases.
49+
:id: I_ARMI_CASE_MOD0
50+
:implements: R_ARMI_CASE_MOD
51+
4852
Attributes
4953
----------
5054
baseCase : armi.cases.case.Case

armi/cases/tests/test_cases.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,12 @@ def test_clone(self):
262262

263263

264264
class TestCaseSuiteDependencies(unittest.TestCase):
265-
"""CaseSuite tests."""
265+
"""CaseSuite tests.
266+
267+
.. test:: Dependence allows for one case to start after the completion of another.
268+
:id: T_ARMI_CASE_SUITE0
269+
:tests: R_ARMI_CASE_SUITE
270+
"""
266271

267272
def setUp(self):
268273
self.suite = cases.CaseSuite(settings.Settings())
@@ -284,6 +289,17 @@ def test_clone(self):
284289
with self.assertRaises(RuntimeError):
285290
_clone = self.suite.clone("test_clone")
286291

292+
def test_checkInputs(self):
293+
"""
294+
Test the checkInputs() method on a couple of cases.
295+
296+
.. test:: Test the checkInputs method.
297+
:id: T_ARMI_CASE_CHECK
298+
:tests: R_ARMI_CASE_CHECK
299+
"""
300+
self.c1.checkInputs()
301+
self.c2.checkInputs()
302+
287303
def test_dependenciesWithObscurePaths(self):
288304
"""
289305
Test directory dependence.

armi/cases/tests/test_suiteBuilder.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ def __call__(self, cs, bp, geom):
4646

4747

4848
class TestLatinHyperCubeSuiteBuilder(unittest.TestCase):
49-
"""Class to test LatinHyperCubeSuiteBuilder."""
49+
"""
50+
Class to test LatinHyperCubeSuiteBuilder.
51+
52+
.. test:: A generic mechanism to allow users to modify user inputs in cases.
53+
:id: T_ARMI_CASE_MOD0
54+
:tests: R_ARMI_CASE_MOD
55+
"""
5056

5157
def test_initialize(self):
5258
builder = LatinHyperCubeSuiteBuilder(case, size=20)

armi/materials/tests/test_air.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@
178178

179179

180180
class Test_Air(unittest.TestCase):
181-
"""unit tests for air materials."""
181+
"""unit tests for air materials.
182+
183+
.. test:: There is a base class for fluid materials.
184+
:id: T_ARMI_MAT_FLUID1
185+
:tests: R_ARMI_MAT_FLUID
186+
"""
182187

183188
def test_pseudoDensity(self):
184189
"""

0 commit comments

Comments
 (0)