Skip to content

Commit

Permalink
Fix tests for testthat 3.2.0 release (#463)
Browse files Browse the repository at this point in the history
* Update snapshots for testthat 3.2.0 release

* skip offline needs curl installed

* Update test-data_to_factor.R
  • Loading branch information
IndrajeetPatil authored Oct 6, 2023
1 parent a2dda58 commit 427127c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Suggests:
rmarkdown,
rstanarm,
see,
testthat (>= 3.1.6),
testthat (>= 3.2.0),
tibble,
tidyr,
withr
Expand Down
23 changes: 23 additions & 0 deletions tests/testthat/_snaps/contr.deviation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# contr.deviation | snapshot

Code
solve(c.deviation)
Output
4 6 8
Intercept 0.3333333 0.3333333 0.3333333
6 -1.0000000 1.0000000 0.0000000
8 -1.0000000 0.0000000 1.0000000

---

Code
solve(mm)
Output
cyl4.am0 cyl4.am1 cyl6.am0 cyl6.am1 cyl8.am0 cyl8.am1
(Intercept) 0.3333333 0.0000000 0.3333333 0.0000000 0.3333333 0.0000000
cyl6 -1.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000
cyl8 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000
am1 -0.3333333 0.3333333 -0.3333333 0.3333333 -0.3333333 0.3333333
cyl6:am1 1.0000000 -1.0000000 -1.0000000 1.0000000 0.0000000 0.0000000
cyl8:am1 1.0000000 -1.0000000 0.0000000 0.0000000 -1.0000000 1.0000000

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/data_rescale.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Code
head(rescale(iris, to = c(0, 1)))
Message <simpleMessage>
Message
Variables of class `factor` can't be rescaled and remain unchanged.
Output
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
Expand Down Expand Up @@ -30,7 +30,7 @@

Code
head(rescale(iris, to = list(Sepal.Length = c(0, 1), Petal.Length = c(-1, 0))))
Message <simpleMessage>
Message
Variables of class `factor` can't be rescaled and remain unchanged.
Output
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/data_separate.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

Code
data_separate(d_sep, guess_columns = "mode", select = NULL)
Message <simpleMessage>
Message
Column `x` had different number of values after splitting. Variable was
split into 3 columns.
`x` returned more columns than expected after splitting. Right-most
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-data_read.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
skip_on_cran()
skip_if_offline()

skip_if_not_installed("httr")
skip_if_not_installed("readxl")
skip_if_not_installed("haven")
skip_if_not_installed("readr")
skip_if_not_installed("data.table")
skip_if_not_installed("rio")

skip_on_cran()

skip_if_not_installed("curl")
skip_if_offline()

# csv -------------------------

test_that("data_read - csv", {
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-data_to_factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ test_that("to_factor regex", {

# SPSS file, many value labels -----------------------------------

skip_on_cran()
skip_if_offline()

skip_if_not_installed("httr")
skip_if_not_installed("haven")

skip_on_cran()

skip_if_not_installed("curl")
skip_if_offline()

# Output validated against SPSS output from original dataset

test_that("data_read, convert many labels correctly", {
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-data_write.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
skip_on_cran()
skip_if_offline()

skip_if_not_installed("httr")
skip_if_not_installed("haven")
skip_if_not_installed("readr")

skip_on_cran()

skip_if_not_installed("curl")
skip_if_offline()

# prepare data set ---------------

data(efc)
Expand Down

0 comments on commit 427127c

Please sign in to comment.