Skip to content

Add more tests for rd_region and summary#1260

Open
eivindjahren wants to merge 2 commits into
mainfrom
add_more_tests
Open

Add more tests for rd_region and summary#1260
eivindjahren wants to merge 2 commits into
mainfrom
add_more_tests

Conversation

@eivindjahren

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional test coverage for resdata.summary.Summary and ResdataRegion selection/keyword operations to better validate edge cases and supported keyword shapes/dtypes.

Changes:

  • Add a Summary test case ensuring timesteps can be derived from DAY/MONTH/YEAR keywords when TIME is absent.
  • Expand ResdataRegion tests to cover polygon “outside” selection, invert behavior, plane selection sizing, and support for active-sized vs global-sized keywords across multiple dtypes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/rd_tests/test_sum.py Adds a regression test for reading summary timesteps from DAY/MONTH/YEAR keywords (no TIME).
tests/rd_tests/test_region.py Adds fixtures and tests covering more ResdataRegion selection APIs and keyword size/dtype handling.
Comments suppressed due to low confidence (2)

tests/rd_tests/test_region.py:481

  • circumference_polygon and grid are passed as fixtures but not used in the test body (the grid is already accessible via empty_region). Removing unused fixture parameters keeps the test intent clearer.
def test_that_select_outside_polygon_leaves_only_cells_outside_polygon(
    circumference_polygon, empty_region, grid
):

tests/rd_tests/test_region.py:491

  • circumference_polygon is passed as a fixture but not used in the test body. Removing unused fixture parameters keeps the test intent clearer.
def test_that_deselect_outside_polygon_only_removes_cells_outside_polygon(
    circumference_polygon, full_region
):

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +432 to +436
# The plane x=5 (normal (1,0,0)) splits the 10x10x1 grid so that the
# 5x10 slab of cells with i in [0,4] lies strictly below (x<5).
region = empty_region.copy()
region.select_below_plane((1.0, 0.0, 0.0), (5.0, 0.0, 0.0))
assert region.global_size() == 50
Comment on lines +429 to +431
def test_that_select_below_plane_selects_cells_strictly_on_negative_side(
empty_region, grid
):

@MagnusSletten MagnusSletten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More tests are always nice! Easy approval from my side. I see copilot noticed a few minor improvements, but those should be trivial to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants