Skip to content

Commit baa64ea

Browse files
Merge branch 'master' into test/data-functions-edge-cases
2 parents 5a05326 + a86c556 commit baa64ea

4 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
covr::to_cobertura(cov)
4141
shell: Rscript {0}
4242

43-
- uses: codecov/codecov-action@v5
43+
- uses: codecov/codecov-action@v6
4444
with:
4545
# Fail if error if not on PR, or if on PR and token is given
4646
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# bayesplot (development version)
22

33
* Added singleton-dimension edge-case tests for exported `_data()` functions.
4+
* Fixed `is_chain_list()` to correctly reject empty lists instead of silently returning `TRUE`.
45
* Added unit tests for `mcmc_areas_ridges_data()`, `mcmc_parcoord_data()`, and `mcmc_trace_data()`.
56
* Added unit tests for `ppc_error_data()` and `ppc_loo_pit_data()` covering output structure, argument handling, and edge cases.
67
* Added vignette sections demonstrating `*_data()` companion functions for building custom ggplot2 visualizations (#435)

R/helpers-mcmc.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ df_with_chain2array <- function(x) {
247247
#' @param x object to check
248248
#' @return TRUE or FALSE
249249
is_chain_list <- function(x) {
250+
if (length(x) == 0) {
251+
return(FALSE)
252+
}
250253
check1 <- !is.data.frame(x) && is.list(x)
251254
dims <- try(sapply(x, function(chain) length(dim(chain))), silent=TRUE)
252255
if (inherits(dims, "try-error")) {

tests/testthat/test-helpers-mcmc.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ test_that("is_chain_list works", {
156156
expect_true(is_chain_list(chainlist))
157157
expect_true(is_chain_list(chainlist1))
158158
expect_true(is_chain_list(chainlist1chain))
159+
expect_false(is_chain_list(list()))
159160
})
160161

161162
test_that("validate_chain_list works", {

0 commit comments

Comments
 (0)