Skip to content

Commit

Permalink
Apply minor updates to allow for changes in dependencies
Browse files Browse the repository at this point in the history
* Modify tests for change to cli::cli_vec truncation
* Add vec_ptype_abbr.haven_labelled_spss due to r-lib/vctrs#1571
  • Loading branch information
gorcha committed Dec 14, 2022
1 parent 6e2903b commit be597a3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
SystemRequirements: GNU make, C++11, zlib: zlib1g-dev (deb), zlib-devel
(rpm)
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ S3method(vec_ptype2,haven_labelled_spss.integer)
S3method(vec_ptype2,integer.haven_labelled)
S3method(vec_ptype2,integer.haven_labelled_spss)
S3method(vec_ptype_abbr,haven_labelled)
S3method(vec_ptype_abbr,haven_labelled_spss)
S3method(vec_ptype_full,haven_labelled)
S3method(vec_ptype_full,haven_labelled_spss)
S3method(zap_formats,data.frame)
Expand Down
5 changes: 5 additions & 0 deletions R/labelled_spss.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ vec_ptype_full.haven_labelled_spss <- function(x, ...) {
paste0("labelled_spss<", vec_ptype_full(vec_data(x)), ">")
}

#' @export
vec_ptype_abbr.haven_labelled_spss <- function(x, ...) {
paste0(vec_ptype_abbr(vec_data(x)), "+lbl")
}

#' @export
obj_print_footer.haven_labelled_spss <- function(x, ...) {
na_values <- attr(x, "na_values")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/labelled.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

`..1` and `..2` have conflicting value labels.
i Labels for these values will be taken from `..1`.
x Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
x Values: 1, 2, 3, 4, 5, 6, 7, 8, ..., 11, and 12

# printed output is stable

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/labelled_spss.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@

`..1` and `..2` have conflicting value labels.
i Labels for these values will be taken from `..1`.
x Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
x Values: 1, 2, 3, 4, 5, 6, 7, 8, ..., 11, and 12

4 changes: 2 additions & 2 deletions tests/testthat/test-labelled.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ test_that("warn only for conflicting labels", {
})

expect_snapshot_warning({
x <- labelled(1:2, c(a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11))
y <- labelled(1:2, c(A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8, I = 9, J = 10, K = 11))
x <- labelled(1:2, c(a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12))
y <- labelled(1:2, c(A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8, I = 9, J = 10, K = 11, L = 12))
c(x, y)
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-labelled_spss.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ test_that("warn only for conflicting labels", {
})

expect_snapshot_warning({
x <- labelled_spss(1:2, c(a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11))
y <- labelled_spss(1:2, c(A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8, I = 9, J = 10, K = 11))
x <- labelled_spss(1:2, c(a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12))
y <- labelled_spss(1:2, c(A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8, I = 9, J = 10, K = 11, L = 12))
c(x, y)
})
})
Expand Down

0 comments on commit be597a3

Please sign in to comment.