Skip to content

Commit

Permalink
fix for has_theta passed a family object and a test
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Feb 7, 2022
1 parent 6f16512 commit 5696b9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/distribution-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
#' p <- theta(m)
`has_theta` <- function(object) {
theta_fun <- if (inherits(object, "family")) {
family$getTheta
object$getTheta
} else {
family(object)$getTheta
}
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-distribution-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ test_that("has_theta() returns TRUE for a nb() GAM", {
expect_true(has_theta(m_nb))
})

test_that("has_theta() returns TRUE for a nb() GAM", {
expect_true(has_theta(nb()))
})

test_that("has_theta() returns FALSE for a poisson() GAM", {
expect_false(has_theta(b_pois))
})
Expand Down

0 comments on commit 5696b9c

Please sign in to comment.