From ddd80edba8e45453233216e1953391ad9a08c56b Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Thu, 11 May 2023 08:39:14 -0700 Subject: [PATCH] Fix prism_layer test when accessing PyVista cells Since the latest PyVista update, the `UnstructuredGrid.cell` attribute is a generator, and therefore it cannot be indexed. This broke our tests, that were indexing cells in the `UnstructuredGrid` for prism layers to compare them with the boundaries of each prism in the layer. --- harmonica/tests/test_prism_layer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/harmonica/tests/test_prism_layer.py b/harmonica/tests/test_prism_layer.py index d94ae8377..5e65e0335 100644 --- a/harmonica/tests/test_prism_layer.py +++ b/harmonica/tests/test_prism_layer.py @@ -420,8 +420,8 @@ def test_to_pyvista(dummy_layer, properties, drop_null_prisms): assert pv_grid.n_cells == 20 assert pv_grid.n_points == 20 * 8 # Check coordinates of prisms - for i, prism in enumerate(layer.prism_layer._to_prisms()): - npt.assert_allclose(prism, pv_grid.cell[i].bounds) + for prism, cell in zip(layer.prism_layer._to_prisms(), pv_grid.cell): + npt.assert_allclose(prism, cell.bounds) # Check properties of the prisms if properties is None: assert pv_grid.n_arrays == 0