Skip to content

Commit

Permalink
Fix failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
crsh committed Sep 27, 2023
1 parent 7cc78df commit 75f142c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Suggests:
beeswarm,
boot,
car,
dplyr,
dplyr (>= 1.1.0),
effectsize (>= 0.4.4),
emmeans,
ggforce,
Expand Down
40 changes: 20 additions & 20 deletions tests/testthat/test_apa_print_emm_lsm.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,19 @@ test_that(
, labels = list(
contrast = "Contrast"
, estimate = "$\\Delta M$"
, conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$"
, conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$"
, statistic = "$t$"
, df = "$\\mathit{df}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Tukey(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Tukey(3)}$"
)
, term_names = c("Neg_Neu", "Neg_Pos", "Neu_Pos")
)

expect_apa_term(
tw_me_pairs_emm_output
, term = "Neg_Neu"
, estimate = "$\\Delta M = -1.10$, $95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$ $[-3.44, 1.24]$"
, statistic = "$t(8) = -1.34$, $p_\\mathrm{\\scriptsize Tukey(3)} = .413$"
, estimate = "$\\Delta M = -1.10$, $95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$ $[-3.44, 1.24]$"
, statistic = "$t(8) = -1.34$, $p_\\mathrm{\\scriptstyle Tukey(3)} = .413$"
)

## Custom contrast names
Expand Down Expand Up @@ -670,8 +670,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_bonf_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Bonferroni(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Bonferroni(3)}$"
)
)

Expand All @@ -680,8 +680,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_tukey_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Tukey(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Tukey(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Tukey(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Tukey(3)}$"
)
)

Expand All @@ -690,8 +690,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_holm_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Holm(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Holm(3)}$"
)
)

Expand All @@ -700,8 +700,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_fdr_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize FDR(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Bonferroni(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle FDR(3)}$"
)
)

Expand All @@ -710,8 +710,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_dun_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Dunnett(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Dunnett(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Dunnett(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Dunnett(3)}$"
)
)

Expand All @@ -720,8 +720,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(3)}$"
)
)

Expand All @@ -730,8 +730,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(3)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(3)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(3)}$"
)
)

Expand All @@ -740,8 +740,8 @@ test_that(
expect_equal(
variable_label(ow_me_emm_scheffe_res$table[, c("conf.int", "adj.p.value")])
, list(
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptsize Scheff\\'e(2)}$"
, adj.p.value = "$p_\\mathrm{\\scriptsize Scheff\\'e(2)}$"
conf.int = "$95\\%\\ \\mathrm{CI}_\\mathrm{\\scriptstyle Scheff\\'e(2)}$"
, adj.p.value = "$p_\\mathrm{\\scriptstyle Scheff\\'e(2)}$"
)
)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_apa_print_merMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ test_that(
group<-c("intervention", "control","control","intervention","control")

library("dplyr")
df<-data.frame(participant,group) %>%
df <- data.frame(participant,group) %>%
group_by(participant,group) %>%
summarise(session=c("t1","t2","t3","t4")) %>%
reframe(session=c("t1","t2","t3","t4")) %>%
group_by(participant, group, session) %>%
summarise(task=c("a","b")) %>%
reframe(task=c("a","b")) %>%
ungroup() %>%
mutate(errors=floor(runif(n=40,min=0,max=30)))

Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test_apa_results_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ test_that(
test_that(
"print.apa_results_table()"
, {
with(
x <- with(
npk
, t.test(
yield[N == "1"]
, yield[N == "2"]
yield[N == "0"]
, yield[N == "1"]
, paired = TRUE
)
)
x <- apa_print()$table
) |>
apa_print()

print_apa_results_table <- capture_output(print(x))
print_apa_results_table <- capture_output(print(x$table))
expect_identical(
print_apa_results_table
, "A data.frame with 5 labelled columns:\n\n estimate conf.int statistic df p.value\n1 -5.62 [-9.93, -1.31] -2.87 11 .015\n\nestimate : $M_D$ \nconf.int : 95\\\\% CI \nstatistic: $t$ \ndf : $\\\\mathit{df}$ \np.value : $p$ "
Expand Down

0 comments on commit 75f142c

Please sign in to comment.