From 29ae88d67948f0f2471782ad819e592006925ce8 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 11 Oct 2023 21:36:53 +0200 Subject: [PATCH] Updates for testthat 3.2.0 --- CITATION.cff | 8 +- DESCRIPTION | 2 +- codemeta.json | 4 +- tests/testthat/_snaps/ggcoefstats.md | 2 +- .../ggcoefstats/nas-in-numeric-columns.svg | 140 ------------------ tests/testthat/_snaps/utils.md | 2 +- tests/testthat/helper-state.R | 13 ++ tests/testthat/test-ggcoefstats.R | 26 +--- 8 files changed, 23 insertions(+), 174 deletions(-) delete mode 100644 tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg create mode 100644 tests/testthat/helper-state.R diff --git a/CITATION.cff b/CITATION.cff index 9bff8cf41..c7499e10c 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -109,7 +109,7 @@ references: abstract: 'datawizard: Easy Data Wrangling and Statistical Transformations' notes: Imports url: https://easystats.github.io/datawizard/ - repository: https://CRAN.R-project.org/package=datawizard + repository: https://easystats.r-universe.dev authors: - family-names: Patil given-names: Indrajeet @@ -447,8 +447,8 @@ references: given-names: Indrajeet email: patilindrajeet.science@gmail.com orcid: https://orcid.org/0000-0003-1995-6531 - year: '2023' version: '>= 1.5.2.9000' + year: '2023' - type: software title: tidyr abstract: 'tidyr: Tidy Messy Data' @@ -696,7 +696,7 @@ references: given-names: Hadley email: hadley@posit.co year: '2023' - version: '>= 3.1.10' + version: '>= 3.2.0' - type: software title: tibble abstract: 'tibble: Simple Data Frames' @@ -748,7 +748,7 @@ references: given-names: Jim - family-names: Henry given-names: Lionel - email: lionel@rstudio.com + email: lionel@posit.co - family-names: Müller given-names: Kirill email: krlmlr+r@mailbox.org diff --git a/DESCRIPTION b/DESCRIPTION index a15165c31..8690e8cec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -65,7 +65,7 @@ Suggests: psych, rmarkdown, survival, - testthat (>= 3.1.10), + testthat (>= 3.2.0), tibble, vdiffr (>= 1.0.7), withr, diff --git a/codemeta.json b/codemeta.json index 15444dd50..1dd22df06 100644 --- a/codemeta.json +++ b/codemeta.json @@ -220,7 +220,7 @@ "@type": "SoftwareApplication", "identifier": "testthat", "name": "testthat", - "version": ">= 3.1.10", + "version": ">= 3.2.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -525,7 +525,7 @@ }, "SystemRequirements": null }, - "fileSize": "9422.075KB", + "fileSize": "9388.713KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/tests/testthat/_snaps/ggcoefstats.md b/tests/testthat/_snaps/ggcoefstats.md index fe508cca8..b4720ddb3 100644 --- a/tests/testthat/_snaps/ggcoefstats.md +++ b/tests/testthat/_snaps/ggcoefstats.md @@ -2,7 +2,7 @@ The tidy data frame *must* contain 'estimate' column. -# edge cases +# works when CIs unavailable Elements in `term` column must be unique. diff --git a/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg b/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg deleted file mode 100644 index ae36fd104..000000000 --- a/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -β - -= -251.41 -, - -t -( -174 -) -= -36.84 -, - -p -= -4.37e-84 - -β - -= -10.47 -, - -t -( -174 -) -= -6.77 -, - -p -= -1.88e-10 - - -(Intercept) -Days -SD (Intercept) -SD (Days) -Cor (Intercept~Days) -SD (Observations) - - - - - - - - - -0 -100 -200 -estimate -term -A -I -C -= -1756 -, - -B -I -C -= -1775 - - diff --git a/tests/testthat/_snaps/utils.md b/tests/testthat/_snaps/utils.md index bec5eb611..61fa670d9 100644 --- a/tests/testthat/_snaps/utils.md +++ b/tests/testthat/_snaps/utils.md @@ -20,7 +20,7 @@ Code .is_palette_sufficient("RColorBrewer", "Dark2", 20L) - Message + Message Number of labels is greater than default palette color count. * Select another color `palette` (and/or `package`). Output diff --git a/tests/testthat/helper-state.R b/tests/testthat/helper-state.R new file mode 100644 index 000000000..d1f98912c --- /dev/null +++ b/tests/testthat/helper-state.R @@ -0,0 +1,13 @@ +testthat::set_state_inspector(function() { + list( + attached = search(), + connections = nrow(showConnections()), + cwd = getwd(), + envvars = Sys.getenv(), + libpaths = .libPaths(), + locale = Sys.getlocale(), + options = .Options, + packages = .packages(all.available = TRUE), + NULL + ) +}) diff --git a/tests/testthat/test-ggcoefstats.R b/tests/testthat/test-ggcoefstats.R index 1ec7d8c84..bebd572ba 100644 --- a/tests/testthat/test-ggcoefstats.R +++ b/tests/testthat/test-ggcoefstats.R @@ -131,31 +131,7 @@ test_that( # edge cases ------------------------------------- test_that( - desc = "missing values in numeric columns", - code = { - skip_if_not_installed("lme4") - skip_on_os(c("windows", "linux", "solaris")) - - withr::local_package("lme4") - m_lmer <- ggcoefstats( - lme4::lmer(Reaction ~ Days + (Days | Subject), - data = lme4::sleepstudy - ) - ) - - expect_s3_class(m_lmer, "ggplot") - - skip_on_os("mac", c("i386", "x86_64")) - set.seed(123) - expect_doppelganger( - title = "NAs in numeric columns", - fig = m_lmer - ) - } -) - -test_that( - desc = "edge cases", + desc = "works when CIs unavailable", code = { set.seed(123) df_base <- tidy_model_parameters(stats::lm(wt ~ am * cyl, mtcars))