Skip to content

Commit

Permalink
reduce elapsed test time
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Sep 27, 2024
1 parent 15b6fbf commit 7fa2648
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ skip_if_not_installed("modeldata")
library(modeldata)
data(hpc_data)

x <- hpc_data[, 2:5]
x <- hpc_data[1:300, 2:5]
fit <- pam(x, k = 3)

test_that("pam tidier arguments", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-emmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ test_that("tidy.emmGrid for combined contrasts", {
method = "consec",
simple = "each",
combine = TRUE,
adjust = "mvt"
adjust = "dunnettx"
)
td_noise <- tidy(noise_c.s)

Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-ergm.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ library(ergm)
data(florentine)
data(faux.mesa.high)

# cut down on elapsed time at the expense of model performance
ctrl <- control.ergm(MCMLE.maxit = 2)

gest <- ergm(flomarriage ~ edges + absdiff("wealth"))
gest2 <- ergm(flomarriage ~ edges + absdiff("wealth"), family = "gaussian")
suppressWarnings({
gest3 <- ergm(faux.mesa.high ~ edges + degree(1:3))
gest3 <- ergm(faux.mesa.high ~ edges + degree(1:3), control = ctrl)
})

test_that("ergm tidier arguments", {
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-glmnetUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ skip_if_not_installed("modeldata")
library(modeldata)
data(hpc_data)

hpc_data <- hpc_data[1:300, ]

fit <- glmnet(formula = mpg ~ ., data = mtcars)
fit2 <- glmnet(
formula = class ~ compounds + input_fields + iterations + num_pending,
Expand Down Expand Up @@ -58,8 +60,8 @@ test_that("tidy.glmnet.formula", {

expect_is(td2, "tbl_df")

expect_equal(dim(td2), c(983L, 6L))
expect_equal(dim(td2z), c(1240L, 6L))
expect_equal(dim(td2), c(1511L, 6L))
expect_equal(dim(td2z), c(2000L, 6L))

expect_true(all(td2$estimate != 0))
expect_true(any(td2z$estimate == 0))
Expand Down

0 comments on commit 7fa2648

Please sign in to comment.