Skip to content

Commit d73d9e2

Browse files
committed
Added comments on why we need to do certain tests that way.
1 parent 28ae5d3 commit d73d9e2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/testthat/test-step_epi_naomit.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ z2 <- r %>%
2121
step_naomit(all_predictors()) %>%
2222
step_naomit(all_outcomes(), skip = TRUE)
2323

24-
# Test
24+
# Checks the behaviour of a step function, omitting the quosure and id that
25+
# differ from one another, even with identical behaviour
26+
behav <- function(recipe,step_num) recipe$steps[[step_num]][-1][-5]
27+
# Checks the class type of an object
28+
step_class <- function(recipe,step_num) class(recipe$steps[step_num])
29+
2530
test_that("Check that both functions behave the same way", {
26-
expect_identical(z1$steps[[3]][-1][-5],z2$steps[[3]][-1][-5])
27-
expect_identical(z1$steps[[4]][-1][-5],z2$steps[[4]][-1][-5])
28-
expect_identical(class(z1$steps[[3]]),class(z2$steps[[3]]))
29-
expect_identical(class(z1$steps[[4]]),class(z2$steps[[4]]))
31+
expect_identical(behav(z1,3),behav(z2,3))
32+
expect_identical(behav(z1,4),behav(z2,4))
33+
expect_identical(step_class(z1,3),step_class(z2,3))
34+
expect_identical(step_class(z1,4),step_class(z2,4))
3035
})

0 commit comments

Comments
 (0)