Skip to content

Commit

Permalink
Add test for HexGrid._roughlyEqual with slightly different pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Jan 20, 2025
1 parent 401b402 commit 121d2c2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions armi/reactor/grids/tests/test_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,17 @@ def test_rotatedIndexGridAssignment(self):
postRotate = base.rotateIndex(loc, rotations=2)
self.assertIs(postRotate.grid, loc.grid)

def test_rotatedIndexRoughEqualPitch(self):
"""Test indices can be rotated in close but not exactly equal grids."""
base = grids.HexGrid.fromPitch(1.345)
other = grids.HexGrid.fromPitch(base.pitch * 1.00001)

for i, j in ((0, 0), (1, 1), (2, 1), (-1, 3)):
loc = grids.IndexLocation(i, j, k=0, grid=base)
fromBase = base.rotateIndex(loc, rotations=2)
fromOther = other.rotateIndex(loc, rotations=2)
self.assertEqual((fromBase.i, fromBase.j), (fromOther.i, fromOther.j))


class TestBoundsDefinedGrid(unittest.TestCase):
def test_positions(self):
Expand Down

0 comments on commit 121d2c2

Please sign in to comment.