Skip to content

Conversation

Copy link

Copilot AI commented Dec 30, 2025

Adds test coverage for error handling in validate_density_bounds across density plotting functions, addressing review feedback from #405.

Changes

  • test-ppc-distributions.R: Added "density PPC/PPD plots reject invalid bounds" test block
  • test-mcmc-distributions.R: Added "mcmc density plots reject invalid bounds" test block

Coverage

Tests verify all validation branches via ppc_dens_overlay and mcmc_dens:

  • Non-numeric bounds (c("a", "b"))
  • Wrong length (c(0, 1, 2), 1)
  • NA values (c(0, NA), c(NA, 1))
  • Invalid ordering (c(1, 0), c(1, 1))
test_that("density PPC/PPD plots reject invalid bounds", {
  expect_error(ppc_dens_overlay(y, yrep, bounds = c("a", "b")),
               "`bounds` must be a numeric vector of length 2")
  expect_error(ppc_dens_overlay(y, yrep, bounds = c(1, 0)),
               "`bounds` must satisfy bounds\\[1\\] < bounds\\[2\\]")
})

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: VisruthSK <67435125+VisruthSK@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tests for invalid bounds in plotting function Add tests for invalid bounds in density plotting functions Dec 30, 2025
Copilot AI requested a review from VisruthSK December 30, 2025 02:27
Copy link
Member

@VisruthSK VisruthSK left a comment

Choose a reason for hiding this comment

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

Lgtm, dunno if the syntax for expect_error is correct though. Will see on test fails

@VisruthSK VisruthSK marked this pull request as ready for review December 30, 2025 02:54
@VisruthSK VisruthSK merged commit c14f39f into forward-bounds-argument Dec 30, 2025
1 check failed
@VisruthSK VisruthSK deleted the copilot/sub-pr-405 branch December 30, 2025 02:54
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.

2 participants