Skip to content

Commit

Permalink
Use expect_type() where appropriate in tests (#6217)
Browse files Browse the repository at this point in the history
* Use expect_type where appropriate

Similar to #6211 -- caught with `lintr::expect_type_linter()`.

* one more
  • Loading branch information
MichaelChirico authored May 24, 2022
1 parent 778ec9b commit 33f16b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-bind.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@ test_that("bind_rows() promotes integer to numeric", {
df2 <- tibble(a = 1, b = 1L)

res <- bind_rows(df1, df2)
expect_equal(typeof(res$a), "double")
expect_equal(typeof(res$b), "integer")
expect_type(res$a, "double")
expect_type(res$b, "integer")
})

test_that("bind_rows() promotes factor to character with warning", {
df1 <- tibble(a = factor("a"))
df2 <- tibble(a = "b")

res <- bind_rows(df1, df2)
expect_equal(typeof(res$a), "character")
expect_type(res$a, "character")
})

test_that("bind_rows() coerces factor when levels don't match", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-deprec-funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ test_that("can enfun() purrr-style lambdas", {
my_mean <- as_function(~ mean(.x))
res <- enfun(~ mean(.x))
expect_equal(length(res), 1L)
expect_true(typeof(res[[1]]) == "closure")
expect_type(res[[1]], "closure")
})

test_that("funs_ works", {
Expand Down

0 comments on commit 33f16b9

Please sign in to comment.