Skip to content

Commit

Permalink
Improve UniformGrid assert fail test
Browse files Browse the repository at this point in the history
The way the test message was compared brought problems with
different python versions.
  • Loading branch information
marco-2023 committed Oct 30, 2024
1 parent 9345cc3 commit 896fb29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/grid/tests/test_cubic.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,10 @@ def test_raises_error_correctly_when_constructing_uniform_grid(self):
)
# Test shape is always positive
with self.assertRaises(ValueError) as err:
UniformGrid(proper_origin, proper_axes, np.array([5, -1, 2]))
grid_shape = np.array([5, -1, 2])
UniformGrid(proper_origin, proper_axes, grid_shape)
self.assertEqual(
"Number of points in each direction should be positive, got shape=[5, -1, 2]",
f"Number of points in each direction should be positive, got shape={list(grid_shape)}",
str(err.exception),
)
# Test the weights are correct
Expand Down

0 comments on commit 896fb29

Please sign in to comment.