From 586b8502577fa2766a2128f568f331e0fef6ce6e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Sep 2024 11:24:35 -0700 Subject: [PATCH] Add test for invalid rotatable data types --- armi/utils/tests/test_hexagon.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/armi/utils/tests/test_hexagon.py b/armi/utils/tests/test_hexagon.py index 578f3d06b..2e27559b7 100644 --- a/armi/utils/tests/test_hexagon.py +++ b/armi/utils/tests/test_hexagon.py @@ -296,3 +296,16 @@ def test_emptyRotate(self): empty = np.array(empty) post = hexagon.rotateHexCellData(empty, 2) self.assertIs(post, empty) + + def test_invalidTypes(self): + """Test we can only rotate lists and arrays.""" + invalidData = [ + set(), + 2, + False, + {1: True}, + (0, 1, 2, 3, 4, 5, 6, 7), + ] + for data in invalidData: + with self.assertRaises(TypeError, msg=f"{invalidData=}"): + hexagon.rotateHexCellData(data, 5)