diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-03-03 17:44:12 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-03-03 17:44:12 +0100 |
commit | 77c248ca40b82ec00a756cd82f12968131f78959 (patch) | |
tree | bf7ec1ecb3bf97c95abae864a685fdcfa22e54a4 /tests/testthat/test_tests.R | |
parent | 044b20c3fea5067a0a78bed242848a1b22a8fb27 (diff) |
Reintroduce the skipped test, with a workaround
Diffstat (limited to 'tests/testthat/test_tests.R')
-rw-r--r-- | tests/testthat/test_tests.R | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/testthat/test_tests.R b/tests/testthat/test_tests.R index 018ba9f7..39649223 100644 --- a/tests/testthat/test_tests.R +++ b/tests/testthat/test_tests.R @@ -57,14 +57,21 @@ test_that("Updating fitted models works", { }) test_that("We can do a likelihood ratio test using an update specification", { - skip("This test assigns to globalenv() to work in testthat") - # The following two assignments were made so the update.mkinfit function called - # by lrtest.mkinfit finds these objects when lrtest.mkinfit is called by - # testthat - assign("f_2_mkin", f_2_mkin, globalenv()) - assign("DFOP_par_c", DFOP_par_c, globalenv()) - test_2_mkin_k2 <- lrtest(f_2_mkin, fixed_parms = c(k2 = 0)) + # The following commented assignments were made so the update.mkinfit + # function called by lrtest.mkinfit finds these objects when lrtest.mkinfit + # is called by testthat. + # assign("f_2_mkin", f_2_mkin, globalenv()) + # assign("DFOP_par_c", DFOP_par_c, globalenv()) + + # As we should not risk overwriting something in the global environment, we use a + # workaround for these tests. + + #test_2_mkin_k2 <- lrtest(f_2_mkin, fixed_parms = c(k2 = 0)) + test_2_mkin_k2 <- lrtest(f_2_mkin, update(f_2_mkin, fixed_parms = c(k2 = 0))) expect_equivalent(test_2_mkin_k2[["2", "Pr(>Chisq)"]], 4.851e-8, tolerance = 1e-8) - test_2_mkin_tc <- lrtest(f_2_mkin, error_model = "tc") + + #test_2_mkin_tc <- lrtest(f_2_mkin, error_model = "tc") + test_2_mkin_tc <- lrtest(f_2_mkin, update(f_2_mkin, error_model = "tc")) expect_equivalent(test_2_mkin_tc[["2", "Pr(>Chisq)"]], 7.302e-5, tolerance = 1e-7) + }) |