-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.clump: added tests for r.clump module #4733
base: main
Are you sure you want to change the base?
Conversation
output_maps = parse_command("g.list", type="raster") | ||
assert "clumped_map" in output_maps, "Output raster map 'clumped_map' should exist" | ||
|
||
category_output = read_command("r.category", map="clumped_map").strip().split("\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r.category has json output, you can use parse_command to get the list
for line in category_output | ||
} | ||
|
||
expected_categories = {1: "", 2: "", 3: ""} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why dict with empty keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output for r.category came in the form of {'1': None, '2': None, '3': None}, the categories did not have any labels so i kept the expected categories values empty as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add test for minsize and threshold
@petrasovaa I was trying to test the My map layout looks something like: |
This PR introduces
pytest
-based tests for ther.clump
module to validate its functionality. The tests cover:Basic Functionality: Verifies that
r.clump
correctly identifies clumped regions in a raster map.Diagonal Connectivity: Tests the
-d
flag for identifying clumps with diagonal connectivity.The tests use temporary regions and custom raster maps.