-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-zzz.R
35 lines (30 loc) · 881 Bytes
/
test-zzz.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
test_that("remove tensorflow detritus in tempdir", {
tmp <- tempdir()
if (dir.exists(file.path(tmp, "__pycache__"))) {
unlink(file.path(tmp, "__pycache__"), recursive = TRUE, force = TRUE)
}
tmp_py_files <- list.files(tmp, pattern = "^(tmp|__autograph_generated_file).*\\.py$", full.names = TRUE)
file.remove(tmp_py_files)
})
test_that("test helpers", {
expect_equal(NULL %||% 1, 1)
expect_silent(muffle_nans_produced(warning("NaNs produced")))
expect_silent(muffle_warning(warning("a"), "a"))
expect_warning(muffle_warning(warning("a"), "b"), fixed = "a")
expect_equal(
enumerate_strings("a"),
"a"
)
expect_equal(
enumerate_strings(letters[1:2]),
"a and b"
)
expect_equal(
enumerate_strings(letters[1:3]),
"a, b and c"
)
expect_equal(
enumerate_strings(letters[1:3], quote = "'"),
"'a', 'b' and 'c'"
)
})