diff --git a/armi/nuclearDataIO/cccc/tests/test_dlayxs.py b/armi/nuclearDataIO/cccc/tests/test_dlayxs.py index 6ab4ac0fc..fb852e03b 100644 --- a/armi/nuclearDataIO/cccc/tests/test_dlayxs.py +++ b/armi/nuclearDataIO/cccc/tests/test_dlayxs.py @@ -18,7 +18,6 @@ # pylint: disable=missing-function-docstring,missing-class-docstring,protected-access,invalid-name,no-self-use,no-method-argument,import-outside-toplevel import copy import filecmp -import os import unittest import numpy diff --git a/armi/nuclearDataIO/cccc/tests/test_pmatrx.py b/armi/nuclearDataIO/cccc/tests/test_pmatrx.py index 835aa726e..3c2d58756 100644 --- a/armi/nuclearDataIO/cccc/tests/test_pmatrx.py +++ b/armi/nuclearDataIO/cccc/tests/test_pmatrx.py @@ -17,7 +17,6 @@ """ # pylint: disable=missing-function-docstring,missing-class-docstring,protected-access,invalid-name,no-self-use,no-method-argument,import-outside-toplevel import filecmp -import os import unittest from armi import nuclearDataIO diff --git a/armi/operators/tests/test_operatorSnapshots.py b/armi/operators/tests/test_operatorSnapshots.py index caee99aeb..b5608f1e5 100644 --- a/armi/operators/tests/test_operatorSnapshots.py +++ b/armi/operators/tests/test_operatorSnapshots.py @@ -16,11 +16,13 @@ # pylint: disable=missing-function-docstring,missing-class-docstring,protected-access,invalid-name,no-method-argument,import-outside-toplevel import unittest +from armi import settings from armi.bookkeeping.db.databaseInterface import DatabaseInterface +from armi.operators import getOperatorClassFromSettings +from armi.operators.runTypes import RunTypes from armi.operators.snapshots import OperatorSnapshots from armi.reactor.tests import test_reactors from armi.settings.fwSettings.databaseSettings import CONF_FORCE_DB_PARAMS -from armi.operators.runTypes import RunTypes class TestOperatorSnapshots(unittest.TestCase): @@ -62,5 +64,13 @@ def test_mainOperate(self): self.assertEqual(self.r.core.p.power, 100000000.0) +class TestOperatorSnapshotsSettings(unittest.TestCase): + def test_getOperatorClassFromSettings(self): + cs = settings.Settings() + cs = cs.modified(newSettings={"runType": RunTypes.SNAPSHOTS}) + clazz = getOperatorClassFromSettings(cs) + self.assertEqual(clazz, OperatorSnapshots) + + if __name__ == "__main__": unittest.main() diff --git a/armi/physics/neutronics/tests/test_neutronicsPlugin.py b/armi/physics/neutronics/tests/test_neutronicsPlugin.py index a3f61a442..bd9bb2ead 100644 --- a/armi/physics/neutronics/tests/test_neutronicsPlugin.py +++ b/armi/physics/neutronics/tests/test_neutronicsPlugin.py @@ -15,11 +15,11 @@ """unit tests for the neutronics plugin""" # pylint: disable=missing-function-docstring,missing-class-docstring,protected-access,invalid-name,no-self-use,no-method-argument,import-outside-toplevel import io -import os import unittest from ruamel.yaml import YAML +from armi import getPluginManagerOrFail, settings, tests from armi.operators import settingsValidation from armi.physics import neutronics from armi.physics.neutronics.const import CONF_CROSS_SECTION @@ -33,7 +33,6 @@ from armi.tests import TEST_ROOT from armi.tests.test_plugins import TestPlugin from armi.utils import directoryChangers -from armi import getPluginManagerOrFail, settings, tests XS_EXAMPLE = """AA: geometry: 0D diff --git a/armi/reactor/converters/tests/test_geometryConverters.py b/armi/reactor/converters/tests/test_geometryConverters.py index 9bf187923..d84e1239c 100644 --- a/armi/reactor/converters/tests/test_geometryConverters.py +++ b/armi/reactor/converters/tests/test_geometryConverters.py @@ -21,15 +21,14 @@ from numpy.testing import assert_allclose from armi import runLog -from armi import settings from armi.reactor import blocks from armi.reactor import geometry from armi.reactor import grids -from armi.tests import TEST_ROOT from armi.reactor.converters import geometryConverters from armi.reactor.converters import uniformMesh -from armi.reactor.tests.test_reactors import loadTestReactor, reduceTestReactorRings from armi.reactor.flags import Flags +from armi.reactor.tests.test_reactors import loadTestReactor, reduceTestReactorRings +from armi.tests import TEST_ROOT from armi.utils import directoryChangers diff --git a/armi/reactor/tests/test_components.py b/armi/reactor/tests/test_components.py index c6cf9c970..49209ff69 100644 --- a/armi/reactor/tests/test_components.py +++ b/armi/reactor/tests/test_components.py @@ -1382,6 +1382,17 @@ def test_setMassFrac(self): self.fuel.setMassFrac("U235", target35) self.assertAlmostEqual(self.fuel.getMassFrac("U235"), target35) + def test_adjustMassFrac_invalid(self): + with self.assertRaises(ValueError): + self.fuel.adjustMassFrac(nuclideToAdjust="ZR", val=-0.23) + + with self.assertRaises(ValueError): + self.fuel.adjustMassFrac(nuclideToAdjust="ZR", val=1.12) + + alwaysFalse = lambda a: False + self.fuel.parent = None + self.assertIsNone(self.fuel.getAncestorAndDistance(alwaysFalse)) + def test_adjustMassFrac_U235(self): zrMass = self.fuel.getMass("ZR") uMass = self.fuel.getMass("U") diff --git a/armi/reactor/tests/test_composites.py b/armi/reactor/tests/test_composites.py index de3996140..492b12373 100644 --- a/armi/reactor/tests/test_composites.py +++ b/armi/reactor/tests/test_composites.py @@ -260,6 +260,11 @@ def test_getReactionRates(self): self.assertEqual(len(rRates), 6) self.assertEqual(sum([r for r in rRates.values()]), 0) + def test_syncParameters(self): + data = [{"serialNum": 123}, {"flags": "FAKE"}] + numSynced = self.container._syncParameters(data, {}) + self.assertEqual(numSynced, 2) + class TestCompositeTree(unittest.TestCase): diff --git a/armi/tests/test_mpiActions.py b/armi/tests/test_mpiActions.py index 9f842ef77..285a1afa7 100644 --- a/armi/tests/test_mpiActions.py +++ b/armi/tests/test_mpiActions.py @@ -42,6 +42,17 @@ def tearDown(self): context.MPI_SIZE = self._mpiSize context.MPI_RANK = 0 + def test_parallel(self): + self.action.serial = False + self.assertTrue(self.action.parallel) + + self.action.serial = True + self.assertFalse(self.action.parallel) + + def test_serialGather(self): + self.action.serial = True + self.assertEqual(len(self.action.gather()), 1) + def test_mpiIter(self): allObjs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] distObjs = [[0, 1, 2], [3, 4, 5], [6, 7], [8, 9], [10, 11]] diff --git a/armi/utils/tests/test_units.py b/armi/utils/tests/test_units.py index e893960b5..e193427db 100644 --- a/armi/utils/tests/test_units.py +++ b/armi/utils/tests/test_units.py @@ -13,7 +13,6 @@ # limitations under the License. """Test armi.utils.units.py""" # pylint: disable=missing-function-docstring,missing-class-docstring,protected-access,invalid-name,no-self-use,no-method-argument,import-outside-toplevel -import math import unittest from armi.utils import units