Skip to content

Commit 9df4ddd

Browse files
authored
Merge pull request #552 from fweber144/tests_updates
Tests: Adapt to version 0.9.15 of package mclogit
2 parents cd42da6 + 4c6fd49 commit 9df4ddd

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

tests/testthat/helpers/testers.R

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,11 +1270,17 @@ outdmin_tester_aug <- function(
12701270
sub_formul_no_grp <- update(sub_formul,
12711271
. ~ . - (1 | z.1) - (xco.1 | z.1))
12721272
###
1273+
resp_coefs_nm <- if (packageVersion("mclogit") >= "0.9.15") {
1274+
"Logit eqn."
1275+
} else {
1276+
"Response categories"
1277+
}
12731278
expect_identical(
12741279
dimnames(coefs_crr),
1275-
list("Response categories" = tail(augdat_cats, -1),
1276-
"Predictors" = colnames(model.matrix(sub_formul_no_grp,
1277-
data = sub_data))),
1280+
setNames(list(tail(augdat_cats, -1),
1281+
colnames(model.matrix(sub_formul_no_grp,
1282+
data = sub_data))),
1283+
c(resp_coefs_nm, "Predictors")),
12781284
info = info_str
12791285
)
12801286

@@ -1285,7 +1291,21 @@ outdmin_tester_aug <- function(
12851291
expect_named(ranef_crr, NULL, info = info_str)
12861292
expect_true(is.matrix(ranef_crr[[1]]), info = info_str)
12871293
expect_true(is.numeric(ranef_crr[[1]]), info = info_str)
1288-
if (packageVersion("Matrix") >= "1.5-0") {
1294+
if (packageVersion("mclogit") >= "0.9.15") {
1295+
ranef_nms <- apply(
1296+
expand.grid(resp_val = tail(levels(eval_lhs(sub_formul, dat)), -1),
1297+
coef_val = coef_nms,
1298+
grpl_val = levels(dat$z.1)),
1299+
1,
1300+
function(x_row) {
1301+
paste0(x_row["resp_val"], "~", x_row["coef_val"], "|",
1302+
x_row["grpl_val"])
1303+
}
1304+
)
1305+
expect_identical(dimnames(ranef_crr[[1]]),
1306+
list(ranef_nms, NULL),
1307+
info = info_str)
1308+
} else if (packageVersion("Matrix") >= "1.5-0") {
12891309
expect_null(dimnames(ranef_crr[[1]]), info = info_str)
12901310
} else {
12911311
expect_identical(dimnames(ranef_crr[[1]]),

0 commit comments

Comments
 (0)