Skip to content

Commit 56eea5b

Browse files
committed
update tests
1 parent 12a62fc commit 56eea5b

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

tests/testthat/helper-utils.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ test_succeeds <- function(desc, expr, required_version = NULL) {
9090
local_output_sink(nullfile())
9191
}
9292

93+
9394
rlang::eval_tidy(
94-
rlang::expr(test_that({{desc}}, expect_no_error( {{expr}} ))),
95-
env = parent.frame())
95+
rlang::expr(test_that(!!desc, {
96+
expect_no_error( {{expr}} )
97+
expect_true(TRUE) # https://github.com/r-lib/testthat/issues/2037
98+
} ))
99+
# , # env = parent.frame()
100+
)
96101

97102
}
98103

tests/testthat/test-activations.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ context("activations")
44

55
test_activation <- function(name, required_version = NULL, required_tf_version=tf_version()) {
66
test_succeeds(paste("use activation", name), {
7+
# browser()
78
skip_if_no_keras(required_version)
89
skip_if_not_tensorflow_version(required_tf_version)
910
activation_fn <- eval(parse(text = name))
10-
test_call_succeeds(name, {
11-
keras_model_sequential(input_shape = 784) %>%
12-
layer_dense(32) %>%
13-
layer_activation(activation = activation_fn)
14-
})
11+
12+
# test in a model
13+
keras_model_sequential(input_shape = 784) %>%
14+
layer_dense(32) %>%
15+
layer_activation(activation = activation_fn)
16+
17+
# test stand alone
1518
tensor <- op_array(matrix(runif(100), nrow = 10, ncol = 10))
1619
activation_fn(tensor)
1720
})

tests/testthat/test-layer-text_vectorization.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ test_call_succeeds("can use layer_text_vectorization in a functional model", {
3737
if (tensorflow::tf_version() < "2.1")
3838
skip("TextVectorization requires TF version >= 2.1")
3939

40-
x <- matrix(c("hello world", "hello world"), ncol = 1)
40+
# x <- matrix(c("hello world", "hello world"), ncol = 1)
41+
x <- c("hello world", "hello world")
4142

4243
layer <- layer_text_vectorization()
4344
layer %>% adapt(x)
@@ -55,7 +56,8 @@ test_call_succeeds("can set and get the vocabulary of layer_text_vectorization",
5556
if (tensorflow::tf_version() < "2.1")
5657
skip("TextVectorization requires TF version >= 2.1")
5758

58-
x <- matrix(c("hello world", "hello world"), ncol = 1)
59+
# x <- matrix(c("hello world", "hello world"), ncol = 1)
60+
x <- c("hello world", "hello world")
5961

6062
layer <- layer_text_vectorization()
6163

tests/testthat/test-layers-preprocessing.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ test_succeeds("layer_text_vectorization", {
310310
input_shape = c(1), dtype = tf$string)
311311

312312
input_data = rbind("foo qux bar", "qux baz")
313+
input_data = c("foo qux bar", "qux baz")
313314
preds <- model %>% predict(input_data)
314315

315316
expect_equal(preds, rbind(c(2, 1, 4, 0),

0 commit comments

Comments
 (0)