Update test-associndex.R - #64
Conversation
we have updated the test of associndex taking into account the last changes made in the function associndex relative to the argument "threshold_density".
There was a problem hiding this comment.
Code Review
This pull request updates a test in tests/testthat/test-associndex.R to use threshold_density = "Weibull" and deletes another test checking user-provided thresholds. Feedback suggests updating the first test's description to accurately reflect the Weibull thresholding logic, and retaining the deleted test with a valid numeric threshold to preserve test coverage.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
I am having trouble creating individual review comments. Click here to see my feedback.
tests/testthat/test-associndex.R (62)
The test has been updated to use threshold_density = "Weibull" to trigger the Weibull threshold estimation. However, the test description on line 56 still reads "associndex calcula threshold automáticamente". Since the threshold is now explicitly requested via "Weibull" rather than being calculated automatically (the default NULL behavior actually avoids thresholding), the test description should be updated to be more accurate, e.g., "associndex calcula threshold usando Weibull".
tests/testthat/test-associndex.R (68-79)
Instead of completely deleting the test "associndex no calcula threshold si se proporciona", it is better to keep it and update the threshold_density value to a valid numeric limit (e.g., 0). Deleting the test entirely reduces test coverage for the scenario where a user-defined numeric threshold is provided.
# Test 7.- La función no calcula el thresold si se da
test_that("associndex no calcula threshold si se proporciona", {
expect_no_message(
associndex(Amoladeras_int, Amoladeras_cover,
expand = "yes",
rm_sp_no_cover = "allsp",
threshold_density = 0)
)
})Change the tolerance to consider that the area estimated in m2 for canopy and open can differ in 1 m2 the most, as smaller differences can be due to rounding effects
we have updated the test of associndex taking into account the last changes made in the function associndex relative to the argument "threshold_density".