Repository navigation
r.plane: add tests for computed plane values - #7497
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds automated tests for r.plane to validate core plane-generation behaviors in a small synthetic region.
Changes:
- Introduces a new pytest test module for
r.plane. - Adds coverage for a 45° east-dipping plane and a horizontal (dip=0) plane.
- Adds a small helper to parse
r.out.xyzoutput for assertions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The existing testsuite only checks that the output raster exists. Add a pytest module that asserts the actual plane geometry on a synthetic XY region: a 45-degree plane dipping east through the origin gives z == easting, and a horizontal plane (dip=0) equals the given elevation everywhere.
30faf76 to
4220ac0
Compare
|
The failing macOS check here is unrelated to this PR. It is the flaky |
petrasovaa
left a comment
There was a problem hiding this comment.
Use r.stats with format=json instead of r.out.xyz parsing.
Seems the gunittest test can be dropped, no need to duplicate.
|
Thanks Anna, done both:
Verified both tests pass locally. |
The existing testsuite only checks that the output raster exists. Add a pytest module that asserts the actual plane geometry on a synthetic XY region: a 45-degree plane dipping east through the origin gives z == easting, and a horizontal plane (dip=0) equals the given elevation everywhere.
Description
The existing
r.planetestsuite only checks that the output raster exists; itnever verifies the computed values (and it needs the NC sample dataset). This
adds a pytest module that asserts the actual plane geometry on a small synthetic
XY region (no sample dataset required):
z == eastingat everycell.
dip=0) equals the given elevation everywhere.Motivation and context
r.planecomputes a tilted plane from a dip, azimuth, and a point; that math wasuntested. These assertions pin the geometry so a regression in the computation
would be caught.
How has this been tested?
pytest scripts/r.plane/tests/r_plane_test.py— 2 tests pass. Values wereconfirmed against the running tool (
r.out.xyz).ruff formatandruff checkare clean.
Types of changes