Skip to content

Commit eead7db

Browse files
authored
Merge pull request #547 from aloctavodia/nobars_warn
Suppress nobars warning
2 parents f5fb56b + de6acae commit eead7db

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

tests/testthat/test_refmodel.R

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,23 @@ test_that(paste(
260260

261261
# Without `ynew`:
262262
expect_warning(
263-
predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr,
264-
offsetnew = offs_crr, type = "response"),
265-
get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr,
266-
offsetnew = offs_crr),
263+
predref_resp <- withCallingHandlers(
264+
predict(refmods[[tstsetup]], dat,
265+
weightsnew = wobs_crr,
266+
offsetnew = offs_crr,
267+
type = "response"),
268+
warning = function(w) {
269+
if (grepl("nobars.*reformulas", conditionMessage(w))) {
270+
invokeRestart("muffleWarning")
271+
}
272+
}
273+
),
274+
get_warn_wrhs_orhs(tstsetup,
275+
weightsnew = wobs_crr,
276+
offsetnew = offs_crr),
267277
info = tstsetup
268278
)
279+
269280
expect_warning(
270281
predref_link <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr,
271282
offsetnew = offs_crr, type = "link"),

0 commit comments

Comments
 (0)