Skip to content

Add tests for theme/aesthetic helper functions#524

Open
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:test/theme-helper-coverage
Open

Add tests for theme/aesthetic helper functions#524
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:test/theme-helper-coverage

Conversation

@utkarshpawade
Copy link
Copy Markdown
Contributor

Fixes #523

  • Added return type checks (expect_s3_class, incomplete theme validation) for plot_bg(), panel_bg(), facet_bg(), legend_move(), legend_text()
  • Added on = FALSEelement_blank verification for all three background helpers
  • Added composition tests with real bayesplot plots (ppc_hist, ppc_dens_overlay, ppc_dens)
  • Added overlay_function return type check (LayerInstance, not theme) and plot composition
  • Added legend_move("none") equivalence with legend_none()
  • Added test for stacking multiple helpers on a single plot

Copilot AI review requested due to automatic review settings April 2, 2026 16:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds expanded test coverage for bayesplot theme/aesthetic convenience helpers, with checks for return types and compatibility when added to real bayesplot ggplot objects.

Changes:

  • Added tests asserting helper outputs are incomplete themes and map on = FALSE to element_blank().
  • Added composition tests ensuring helpers and overlay_function() can be added to real bayesplot plots.
  • Added a NEWS entry documenting the added tests.

Reviewed changes

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

File Description
tests/testthat/test-convenience-functions.R Adds new testthat cases around theme helper return types and plot composition.
NEWS.md Documents newly added tests for theme/aesthetic helpers.

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.67%. Comparing base (a86c556) to head (31683fe).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #524   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files          35       35           
  Lines        5905     5905           
=======================================
  Hits         5827     5827           
  Misses         78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Add dedicated tests for theme/aesthetic helper functions

3 participants