Unit tests for MeshIndexSet.#7219
Conversation
There was a problem hiding this comment.
- Should have a more thorough parameterisation of the three locations
- Should test whether the original
MeshXYis all lazy connectivities/coords versus all NumPy versions
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## FEATURE_index_set #7219 +/- ##
=====================================================
+ Coverage 89.27% 90.26% +0.99%
=====================================================
Files 92 92
Lines 25555 25570 +15
Branches 4762 4767 +5
=====================================================
+ Hits 22813 23080 +267
+ Misses 1945 1703 -242
+ Partials 797 787 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| _shared_utils.assert_array_equal(result, expected) | ||
|
|
||
| def test_face_location_calculate_node_bool_index(self, mesh_2d): | ||
| index_set = _MeshIndexSet(indices=[1], mesh=mesh_2d, location="face") |
There was a problem hiding this comment.
I think it's worth passing in a more complex case here to properly exercise the maths that's going on under the hood here. I'd say it's worth coming up with a mesh, indices pair with the following properties:
- Multiple cells are indexed.
- The indices are not all consecutive (e.g. [1,2,4])
- Some of the faces being indexed have masked connectivities (e.g. there is a mix of triangles and rectangles).
- Some of the faces are neighbouring (i.e. they share nodes).
- Some of the faces are disconnected from each of the other faces (i.e. they share no nodes).
It's also worth having such a case for edge/node calculations. Once you have such examples, it's worth introducing them to other tests where there are complex calculations happening under the hood.
| import pytest | ||
|
|
||
| from iris.common.lenient import _LENIENT, _qualname | ||
| from iris.common.metadata import BaseMetadata, MeshIndexSetMetadata |
There was a problem hiding this comment.
Probably worth making MeshIndexSetMetadata private since _MeshIndexSet is private.
| assert result.shape == (1,) | ||
| assert result.points[0] == 3100 | ||
|
|
||
| def test_new_mesh_mode(self): |
There was a problem hiding this comment.
I think it's worth getting a bit more specific here about what the resulting mesh ought to actually look like. It's worth maybe reusing the more complex example mesh I mentioned before.
Uh oh!
There was an error while loading. Please reload this page.