Skip to content

Commit

Permalink
Fix prism_layer test when accessing PyVista cells (#409)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
santisoler authored May 11, 2023
1 parent 256cc2d commit abb0ce0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions harmonica/tests/test_prism_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit abb0ce0

Please sign in to comment.