Running ‘testBinaryCut.R’ [3s/4s]
  Running ‘testBinaryPredictor.R’ [4s/5s]
  Running ‘testCleanNaFromContinuous.R’ [3s/5s]
  Running ‘testCleanNaFromFactor.R’ [3s/5s]
  Running ‘testDiscretize.R’ [3s/5s]
  Running ‘testFocalPointQuery.R’ [3s/5s]
  Running ‘testGetStratifiedSample.R’ [3s/5s]
  Running ‘testMergeLevels.R’ [3s/5s]
  Running ‘testModelDefinition.R’ [3s/6s]
  Running ‘testPredictivePower.R’ [3s/6s]
  Running ‘testPreprocess.R’ [3s/5s]
  Running ‘testQuery.R’ [3s/4s]
  Running ‘testQueryFunctions.R’ [3s/5s]
  Running ‘testReliableModelCreation.R’ [3s/6s]
  Running ‘testReliableVariableCreation.R’ [3s/5s]
  Running ‘testToPmml.R’ [5s/8s]
  Running ‘testTransformationReplay.R’ [3s/5s]
  Running ‘testUploadGlmnetModel.R’ [3s/5s]
  Running ‘testWoe.R’ [3s/6s]
  Running ‘utils.R’ [0s/1s]
Running the tests in ‘tests/testTransformationReplay.R’ failed.
Complete output:
  > # Test variable transformation replay
  > # Author: David Barker
  > ###############################################################################
  > library(testthat)
  > library(Causata)
  > 
  > source("utils.R")
  > equals <- testthat::equals
  > 
  > context("TransformationReplay")
  > 
  > test_that("Applying MergeLevels can be replayed", {
  +   max.levels <- 3
  +   
  +   df <- data.frame(var__AP=c("a", "a", "a",  "b", "b",  "c", "d", "e", NA))
  +   cdata <- CausataData(df, rep(0,nrow(df)))
  +   cdata <- MergeLevels(cdata, max.levels=max.levels)
  +   transformer <- GetTransforms(cdata)
  +   
  +   # First, let's be sure that the merging has done what we expect.
  +   #expect_that(cdata$df$var__AP, is_identical_to(factor(c("a", "a", "a",  "b", "b",  "Other", "Other", "Other", NA))))
  +   f1 <- cdata$df$var__AP
  +   f2 <- factor(c("a", "a", "a",  "b", "b",  "Other", "Other", "Other", NA))
  +   expect_that(f1, is_equivalent_to(f2))
  +   
  +   # Now, create a new data.frame and apply the same transformation to it.  Any values in the factor we have
  +   # that is not "a", or "b" should be replaced with "Other"
  +   #
  +   new.df <- data.frame(var__AP=c("a", "b", "c", "c", "c", "d", "a", NA))
  +   transformed <- transformer(new.df)
  +   expect_that(transformed$var__AP, is_equivalent_to(factor(c("a", "b", "Other", "Other", "Other", "Other", "a", NA))))
  + })
  Error: Test failed: 'Applying MergeLevels can be replayed'
  * `x` not equivalent to `expected`.
  Types not compatible: character is not integer
  * `x` not equivalent to `expected`.
  Types not compatible: character is not integer
  Execution halted