Skip to content

Commit

Permalink
Change assertEqual to assertAlmostEqual for pitch
Browse files Browse the repository at this point in the history
Calculating the pitch with a square root creates a machine precision
error.
  • Loading branch information
mgjarrett committed Feb 27, 2024
1 parent 99a8c5d commit 37e1fff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions armi/reactor/grids/tests/test_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def test_is_pickleable(self):
assert_allclose(loc.indices, newLoc.indices)

def test_adjustPitch(self):
"""Adjust the pich of a hexagonal lattice.
"""Adjust the pitch of a hexagonal lattice.
.. test:: Construct a hexagonal lattice with three rings.
:id: T_ARMI_GRID_HEX
Expand All @@ -461,7 +461,7 @@ def test_adjustPitch(self):
grid.changePitch(2.0)
v2 = grid.getCoordinates((1, 0, 0))
assert_allclose(2 * v1 - offset, v2)
self.assertEqual(grid.pitch, 2.0)
self.assertAlmostEqual(grid.pitch, 2.0)

# basic sanity: test number of rings has changed
self.assertEqual(grid._unitStepLimits[0][1], 3)
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/tests/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ def test_retainState(self):
with self.HexBlock.retainState():
self.HexBlock.setType("fuel")
self.HexBlock.spatialGrid.changePitch(2.0)
self.assertEqual(self.HexBlock.spatialGrid.pitch, 1.0)
self.assertAlmostEqual(self.HexBlock.spatialGrid.pitch, 1.0)
self.assertTrue(self.HexBlock.hasFlags(Flags.INTERCOOLANT))

def test_getPinCoords(self):
Expand Down

0 comments on commit 37e1fff

Please sign in to comment.