Skip to content

Commit

Permalink
skip snapshots on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryMcCartan committed Mar 26, 2023
1 parent fa0f871 commit 8d45e07
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions R/causal_idx.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ as_causal_idx <- function(x) {


# printing
# (tests skipped on CI)
# nocov start
#' @export
format.causal_idx <- function(x, ...) {
vapply(vctrs::vec_data(x), format_index_line, "")
}
format_index_line <- function(y) {
paste0("(", paste0(formatC(y[!is.na(y)]), collapse=","), ")")
}
# nocov end

# vctrs -------------------------------------------------------------------

Expand Down
7 changes: 6 additions & 1 deletion R/causal_mod.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ new_causal_mod <- function(x = list(), fitted = double(0), idx = seq_along(fitte
#'
#' d <- rbind(NA, npk)
#' m_mis <- lm(yield ~ block + N*P*K, data=d)
#' fitted(m_mis) # length doesn't match rows of `d`
#' causal_mod(m_mis) # NA for missing value
#' attr(causal_mod(m_mis), "idx")
#'
#' @order 1
#' @export
Expand Down Expand Up @@ -70,14 +72,17 @@ is_causal_mod <- function(x) {


# printing
# (tests skipped on CI)
# nocov start
#' @export
format.causal_mod <- function(x, ...) {
formatC(vctrs::vec_data(x))
}
#' @export
str.causal_mod <- function(object, max.level=2, ...) {
NextMethod(max.level=max.level, ...) # nocov
NextMethod(max.level=max.level, ...)
}
# nocov end

# vctrs -------------------------------------------------------------------

Expand Down
7 changes: 6 additions & 1 deletion R/causal_tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ reconstruct.causal_tbl <- function(data, old) {
#' that a `causal_tbl` has the necessary columns set via helpers like
#' [has_treatment()], [has_outcome()], etc.
#'
#' @param ... passed on to [tibble()]
#' @param ... passed on to [vctrs::df_list()] (for `causal_tbl` only) then
#' [vctrs::new_data_frame()] (both constructors).
#' @param .outcome the column containing the outcome variable (tidy-selected).
#' Can be set later with [set_outcome()].
#' @param .treatment the column containing the treatment variable (tidy-selected).
Expand Down Expand Up @@ -223,6 +224,8 @@ assert_df <- function(data, arg) {


# Printing -----------------------------------------------------------------
# (tests skipped on CI)
# nocov start

#' @importFrom pillar tbl_sum
#' @method tbl_sum causal_tbl
Expand Down Expand Up @@ -278,3 +281,5 @@ ctl_new_pillar.causal_tbl <- function(controller, x, width, ..., title = NULL) {
data = out$data
))
}

# nocov end
2 changes: 2 additions & 0 deletions man/causal_mod.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/causal_tbl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/testthat/test-causal_idx.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ test_that("causal_idx slicing", {


test_that("causal_idx printing", {
skip_on_ci()
skip_on_cran()

idx <- causal_idx(list(2, c(1, NA, 3), 2))

expect_snapshot(print(idx))
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-causal_mod.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ test_that("causal_mod slicing", {


test_that("causal_mod printing", {
skip_on_ci()
skip_on_cran()

m <- lm(yield ~ block + N*P*K, data=npk)
x <- causal_mod(m)

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-causal_tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ test_that("causal_tbl slicing and renaming", {
})

test_that("causal_tbl printing", {
skip_on_ci()
skip_on_cran()

x <- causal_tbl(milk_first = c(0, 1, 0, 1, 1, 0, 0, 1),
guess = c(0, 1, 0, 1, 1, 0, 0, 1),
.outcome = guess,
Expand Down

0 comments on commit 8d45e07

Please sign in to comment.