Skip to content

Commit f758f63

Browse files
committed
Remove test for c() since it is the same as the one for NULL.
1 parent 3fe4d0e commit f758f63

1 file changed

Lines changed: 4 additions & 47 deletions

File tree

tests/testthat/test-data_tabulate.R

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ test_that("data_tabulate data.frame", {
183183

184184
test_that("data_tabulate data.frame with metrics", {
185185
data(efc, package = "datawizard")
186-
x <- data_tabulate(efc, c("e16sex", "c172code"),
187-
metrics = "raw")
186+
x <- data_tabulate(efc, c("e16sex", "c172code"), metrics = "raw")
188187
expect_s3_class(x, "list")
189188
expect_length(x, 2L)
190189
expect_identical(
@@ -247,9 +246,9 @@ test_that("data_tabulate data.frame with metrics", {
247246
})
248247

249248
test_that("data_tabulate data.frame with metrics = NULL", {
249+
# this is equivalent to metrics = c()
250250
data(efc, package = "datawizard")
251-
x <- data_tabulate(efc, c("e16sex", "c172code"),
252-
metrics = NULL)
251+
x <- data_tabulate(efc, c("e16sex", "c172code"), metrics = NULL)
253252
expect_s3_class(x, "list")
254253
expect_length(x, 2L)
255254
expect_identical(
@@ -304,51 +303,9 @@ test_that("data_tabulate data.frame with metrics = NULL", {
304303
)
305304
})
306305

307-
test_that("data_tabulate data.frame with metrics = c()", {
308-
data(efc, package = "datawizard")
309-
x <- data_tabulate(efc,
310-
c("e16sex"),
311-
metrics = c())
312-
expect_s3_class(x, "list")
313-
expect_length(x, 1L)
314-
expect_identical(
315-
attributes(x[[1]]),
316-
list(
317-
names = c(
318-
"Variable",
319-
"Value"
320-
),
321-
row.names = 1:3,
322-
class = c("datawizard_table", "data.frame"),
323-
type = "numeric",
324-
varname = "e16sex",
325-
label = "elder's gender",
326-
object = "e16sex",
327-
duplicate_varnames = c(FALSE, TRUE, TRUE),
328-
total_n = 100L,
329-
valid_n = 100L
330-
)
331-
)
332-
table1 <- x[[1]]
333-
expect_identical(
334-
as.vector(table1$Value),
335-
as.character(c(
336-
sort(
337-
unique(efc$e16sex)
338-
),
339-
NA
340-
))
341-
)
342-
expect_null(table1$N)
343-
expect_null(
344-
table1$`Raw %`
345-
)
346-
})
347-
348306
test_that("data_tabulate data.frame with metrics = 'foo'", {
349307
data(efc, package = "datawizard")
350-
x <- data_tabulate(efc, c("e16sex", "c172code"),
351-
metrics = NULL)
308+
x <- data_tabulate(efc, c("e16sex", "c172code"), metrics = NULL)
352309
expect_s3_class(x, "list")
353310
expect_length(x, 2L)
354311
expect_identical(

0 commit comments

Comments
 (0)