testwhat
testwhat copied to clipboard
check_arg("formula") does not flag incorrect formulas for models that are S4 objects
In Longitudinal Analysis in R, in exercises with models that are S4 objects, check_arg("formula")
does not flag incorrect formulas and the SCT passes with an incorrect entry.
Here is an example from Chapter 4. The following SCT does not highlight mistakes in the formula.
ex() %>% check_correct(
check_object(., "uncond_ri") %>% check_equal(),
check_function(., "glmer") %>% {
check_arg(., "formula") %>% check_equal(eval = FALSE)
check_arg(., "data") %>% check_equal(eval = FALSE)
check_arg(., "family") %>% check_equal(eval = FALSE)
}
)
The following code needs to be included to flag incorrect formula entries:
ex() %>% check_expr("uncond_ri@call$formula") %>% check_result() %>% check_equal(incorrect_msg = "Did you correctly define `uncond_ri`?", append = FALSE)
cc: @sumedh10