@@ -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+
2530test_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