Skip to content

Commit

Permalink
Add testing for fuelCycle utils maxBurnupBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Nov 6, 2024
1 parent 5aae8da commit bd3c7ea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions armi/physics/fuelCycle/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import copy
from unittest import TestCase

import numpy as np
Expand Down Expand Up @@ -139,3 +140,23 @@ def test_assemblyHasPinBurnups(self):
self.assertFalse(self.fuel.hasFlags(Flags.FUEL))
self.fuel.p.pinPercentBu = np.arange(self.N_PINS, dtype=float)
self.assertFalse(utils.assemblyHasFuelPinBurnup(fakeAssem))

def test_maxBurnupBlock(self):
"""Test the ability to find maximum burnup block in an assembly."""
reflector = Block("reflector")
assem = [reflector, self.block]
self.fuel.p.pinPercentBu = [0.1]
expected = utils.maxBurnupBlock(assem)
self.assertIs(expected, self.block)

# add a new block with more burnup higher up the stack
hotter = copy.deepcopy(self.block)
hotter[0].p.pinPercentBu *= 2
expected = utils.maxBurnupBlock(
[reflector, self.block, hotter, self.block, reflector]
)
self.assertIs(expected, hotter)

def test_maxBurnupBlockNoBurnup(self):
with self.assertRaisesRegex(ValueError, "No blocks with burnup found"):
utils.maxBurnupBlock([])

0 comments on commit bd3c7ea

Please sign in to comment.