Running ‘testthat.R’ [6s/10s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(textrecipes)
  Loading required package: recipes
  Loading required package: dplyr
  
  Attaching package: 'dplyr'
  
  The following object is masked from 'package:testthat':
  
      matches
  
  The following objects are masked from 'package:stats':
  
      filter, lag
  
  The following objects are masked from 'package:base':
  
      intersect, setdiff, setequal, union
  
  
  Attaching package: 'recipes'
  
  The following object is masked from 'package:stats':
  
      step
  
  > 
  > test_check("textrecipes")
  ── 1. Error: hashing gives double outputs (@test-hashing.R#19)  ────────────────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-hashing.R:19
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  ...
  13: hashing_function(new_data[, col_names[i], drop = TRUE], paste0(col_names[i], "_", 
         names0(object$num_terms, object$prefix)), object$signed, object$num_terms)
  14: list_to_hash(data, n, signed)
  15: as.matrix(create_dtm(it, vectorizer))
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(hash_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 2. Error: hashing output width changes accordingly with num_terms (@test-hash
  not a function
  1: rec %>% step_tokenize(text) %>% step_texthash(text, num_terms = 256) %>% prep(training = test_data, 
         retain = TRUE) at testthat/test-hashing.R:35
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  ...
  13: hashing_function(new_data[, col_names[i], drop = TRUE], paste0(col_names[i], "_", 
         names0(object$num_terms, object$prefix)), object$signed, object$num_terms)
  14: list_to_hash(data, n, signed)
  15: as.matrix(create_dtm(it, vectorizer))
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(hash_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 3. Error: hashing output width changes accordingly with num_terms (@test-hash
  not a function
  1: recipe(~., data = test_data) %>% step_tokenize(all_predictors()) %>% step_texthash(all_predictors(), 
         num_terms = 2) %>% prep() %>% juice() at testthat/test-hashing.R:50
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: function_list[[i]](value)
  8: prep(.)
  9: prep.recipe(.)
  10: bake(x$steps[[i]], new_data = training)
  11: bake.step_texthash(x$steps[[i]], new_data = training)
  12: hashing_function(new_data[, col_names[i], drop = TRUE], paste0(col_names[i], "_", 
         names0(object$num_terms, object$prefix)), object$signed, object$num_terms)
  13: list_to_hash(data, n, signed)
  14: as.matrix(create_dtm(it, vectorizer))
  15: create_dtm(it, vectorizer)
  16: create_dtm.itoken(it, vectorizer)
  17: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  18: corpus_insert(hash_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  19: iterator$clone(deep = TRUE)
  20: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  21: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 4. Error: printing (@test-hashing.R#75)  ────────────────────────────────────
  not a function
  1: expect_output(prep(rec, training = test_data, verbose = TRUE)) at testthat/test-hashing.R:75
  2: quasi_capture(enquo(object), label, capture_output, width = width)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: capture_output_lines(code, print, width = width)
  5: eval_with_output(code, print = print, width = width)
  6: withr::with_output_sink(temp, withVisible(code))
  7: force(code)
  8: withVisible(code)
  9: eval_bare(get_expr(.quo), get_env(.quo))
  10: prep(rec, training = test_data, verbose = TRUE)
  ...
  14: hashing_function(new_data[, col_names[i], drop = TRUE], paste0(col_names[i], "_", 
         names0(object$num_terms, object$prefix)), object$signed, object$num_terms)
  15: list_to_hash(data, n, signed)
  16: as.matrix(create_dtm(it, vectorizer))
  17: create_dtm(it, vectorizer)
  18: create_dtm.itoken(it, vectorizer)
  19: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  20: corpus_insert(hash_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  21: iterator$clone(deep = TRUE)
  22: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  23: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 5. Error: step_tf works as intended (@test-tf.R#19)  ────────────────────────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-tf.R:19
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  ...
  13: tf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$weight_scheme, object$weight)
  14: as.matrix(list_to_dtm(data, names))
  15: list_to_dtm(data, names)
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 6. Error: step_tf works with vocabulary argument (@test-tf.R#55)  ───────────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-tf.R:55
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  ...
  13: tf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$weight_scheme, object$weight)
  14: as.matrix(list_to_dtm(data, names))
  15: list_to_dtm(data, names)
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 7. Error: step_tf works with other weighting schemes (@test-tf.R#70)  ───────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-tf.R:70
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  ...
  13: tf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$weight_scheme, object$weight)
  14: as.matrix(list_to_dtm(data, names))
  15: list_to_dtm(data, names)
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 8. Error: printing (@test-tf.R#103)  ────────────────────────────────────────
  not a function
  1: expect_output(prep(rec, training = test_data, verbose = TRUE)) at testthat/test-tf.R:103
  2: quasi_capture(enquo(object), label, capture_output, width = width)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: capture_output_lines(code, print, width = width)
  5: eval_with_output(code, print = print, width = width)
  6: withr::with_output_sink(temp, withVisible(code))
  7: force(code)
  8: withVisible(code)
  9: eval_bare(get_expr(.quo), get_env(.quo))
  10: prep(rec, training = test_data, verbose = TRUE)
  ...
  14: tf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$weight_scheme, object$weight)
  15: as.matrix(list_to_dtm(data, names))
  16: list_to_dtm(data, names)
  17: create_dtm(it, vectorizer)
  18: create_dtm.itoken(it, vectorizer)
  19: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  20: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  21: iterator$clone(deep = TRUE)
  22: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  23: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 9. Error: step_tfidf works as intended (@test-tfidf.R#19)  ──────────────────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-tfidf.R:19
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  11: bake(x$steps[[i]], new_data = training)
  12: bake.step_tfidf(x$steps[[i]], new_data = training)
  13: tfidf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$smooth_idf, object$norm, object$sublinear_tf)
  14: list_to_dtm(data, names)
  15: create_dtm(it, vectorizer)
  16: create_dtm.itoken(it, vectorizer)
  17: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  18: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  19: iterator$clone(deep = TRUE)
  20: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  21: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 10. Error: step_tfidf works with vocabulary argument (@test-tfidf.R#58)  ────
  not a function
  1: rec %>% prep(training = test_data, retain = TRUE) at testthat/test-tfidf.R:58
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(., training = test_data, retain = TRUE)
  10: prep.recipe(., training = test_data, retain = TRUE)
  11: bake(x$steps[[i]], new_data = training)
  12: bake.step_tfidf(x$steps[[i]], new_data = training)
  13: tfidf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$smooth_idf, object$norm, object$sublinear_tf)
  14: list_to_dtm(data, names)
  15: create_dtm(it, vectorizer)
  16: create_dtm.itoken(it, vectorizer)
  17: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  18: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  19: iterator$clone(deep = TRUE)
  20: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  21: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 11. Error: printing (@test-tfidf.R#72)  ─────────────────────────────────────
  not a function
  1: expect_output(prep(rec, training = test_data, verbose = TRUE)) at testthat/test-tfidf.R:72
  2: quasi_capture(enquo(object), label, capture_output, width = width)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: capture_output_lines(code, print, width = width)
  5: eval_with_output(code, print = print, width = width)
  6: withr::with_output_sink(temp, withVisible(code))
  7: force(code)
  8: withVisible(code)
  9: eval_bare(get_expr(.quo), get_env(.quo))
  10: prep(rec, training = test_data, verbose = TRUE)
  ...
  13: bake.step_tfidf(x$steps[[i]], new_data = training)
  14: tfidf_function(new_data[, col_names[i], drop = TRUE], object$res[[i]], paste0(object$prefix, 
         "_", col_names[i]), object$smooth_idf, object$norm, object$sublinear_tf)
  15: list_to_dtm(data, names)
  16: create_dtm(it, vectorizer)
  17: create_dtm.itoken(it, vectorizer)
  18: vectorizer(it, grow_dtm = TRUE, skip_grams_window_context = "symmetric", window_size = 0, 
         weights = numeric(0))
  19: corpus_insert(vocab_corpus_ptr, iterator, grow_dtm, skip_grams_window_context, window_size, 
         weights)
  20: iterator$clone(deep = TRUE)
  21: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  22: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 12. Error: step_word2vec works as intended (@test-word2vec.R#15)  ───────────
  not a function
  1: rec1 %>% prep() at testthat/test-word2vec.R:15
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(.)
  10: prep.recipe(.)
  ...
  15: withVisible(eval(expr, pf))
  16: eval(expr, pf)
  17: eval(expr, pf)
  18: x$lda_models %||% attr(word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics), 
         "dict")
  19: word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics)
  20: text2vec::create_vocabulary(it)
  21: create_vocabulary.itoken(it)
  22: it$clone(deep = TRUE)
  23: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  24: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 13. Error: step_word2vec works with num_topics argument (@test-word2vec.R#29)
  not a function
  1: rec1 %>% prep() at testthat/test-word2vec.R:29
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: prep(.)
  10: prep.recipe(.)
  ...
  15: withVisible(eval(expr, pf))
  16: eval(expr, pf)
  17: eval(expr, pf)
  18: x$lda_models %||% attr(word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics), 
         "dict")
  19: word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics)
  20: text2vec::create_vocabulary(it)
  21: create_vocabulary.itoken(it)
  22: it$clone(deep = TRUE)
  23: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  24: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ── 14. Error: printing (@test-word2vec.R#40)  ──────────────────────────────────
  not a function
  1: expect_output(prep(rec, training = okc_text, verbose = TRUE)) at testthat/test-word2vec.R:40
  2: quasi_capture(enquo(object), label, capture_output, width = width)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: capture_output_lines(code, print, width = width)
  5: eval_with_output(code, print = print, width = width)
  6: withr::with_output_sink(temp, withVisible(code))
  7: force(code)
  8: withVisible(code)
  9: eval_bare(get_expr(.quo), get_env(.quo))
  10: prep(rec, training = okc_text, verbose = TRUE)
  ...
  16: withVisible(eval(expr, pf))
  17: eval(expr, pf)
  18: eval(expr, pf)
  19: x$lda_models %||% attr(word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics), 
         "dict")
  20: word_dims(training[, col_names[i], drop = TRUE], n = x$num_topics)
  21: text2vec::create_vocabulary(it)
  22: create_vocabulary.itoken(it)
  23: it$clone(deep = TRUE)
  24: copy_slice(old[[i]], new[[i]], old_new_enclosing_pairs[seq.int(i, length(old))], 
         (i == 1))
  25: makeActiveBinding(name, active_copies[[name]], new_slice$binding)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 66 | SKIPPED: 0 | WARNINGS: 4 | FAILED: 14 ]
  1. Error: hashing gives double outputs (@test-hashing.R#19) 
  2. Error: hashing output width changes accordingly with num_terms (@test-hashing.R#35) 
  3. Error: hashing output width changes accordingly with num_terms (@test-hashing.R#50) 
  4. Error: printing (@test-hashing.R#75) 
  5. Error: step_tf works as intended (@test-tf.R#19) 
  6. Error: step_tf works with vocabulary argument (@test-tf.R#55) 
  7. Error: step_tf works with other weighting schemes (@test-tf.R#70) 
  8. Error: printing (@test-tf.R#103) 
  9. Error: step_tfidf works as intended (@test-tfidf.R#19) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted