Skip to content

Commit cf5e5e4

Browse files
ugh
1 parent 9d663f4 commit cf5e5e4

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

inst/tests/mergelist.Rraw

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,26 @@ test(11.05, cbindlist(list(data.table(a=1L), data.table(), data.table(d=2L), dat
3030
## codecov
3131
test(12.01, cbindlist(data.frame(a=1L)), error="must be a list")
3232
test(12.02, cbindlist(TRUE), error="must be a list")
33-
test(12.03, cbindlist(list(), NA), error="must be TRUE or FALSE")
34-
test(12.04, cbindlist(list(data.table(a=1L), 1L)), error="is not a data.table")
35-
test(12.05, options = c(datatable.verbose=TRUE), cbindlist(list(data.table(a=1:2), data.table(b=1:2))), data.table(a=1:2, b=1:2), output="cbindlist.*took")
36-
test(12.06, cbindlist(list(data.table(), data.table(a=1:2), data.table(b=1:2))), data.table(a=1:2, b=1:2))
37-
test(12.07, cbindlist(list(data.table(), data.table(a=1:2), list(b=1:2))), data.table(a=1:2, b=1:2))
38-
test(12.08, cbindlist(list(data.table(a=integer()), list(b=integer()))), data.table(a=integer(), b=integer()))
33+
test(12.03, cbindlist(list(data.table(a=1L), 1L)), error="is not a data.table")
34+
test(12.04, options = c(datatable.verbose=TRUE), cbindlist(list(data.table(a=1:2), data.table(b=1:2))), data.table(a=1:2, b=1:2), output="cbindlist.*took")
35+
test(12.05, cbindlist(list(data.table(), data.table(a=1:2), data.table(b=1:2))), data.table(a=1:2, b=1:2))
36+
test(12.06, cbindlist(list(data.table(), data.table(a=1:2), list(b=1:2))), data.table(a=1:2, b=1:2))
37+
test(12.07, cbindlist(list(data.table(a=integer()), list(b=integer()))), data.table(a=integer(), b=integer()))
3938
## duplicated names
40-
test(12.09, cbindlist(list(data.table(a=1L, b=2L), data.table(b=3L, d=4L))), data.table(a=1L, b=2L, b=3L, d=4L))
39+
test(12.08, cbindlist(list(data.table(a=1L, b=2L), data.table(b=3L, d=4L))), data.table(a=1L, b=2L, b=3L, d=4L))
4140
local({
4241
# also test that keys, indices are wiped
4342
ans = cbindlist(list(setindexv(data.table(a=2:1, b=1:2), "a"), data.table(a=1:2, b=2:1, key="a"), data.table(a=2:1, b=1:2)))
44-
test(12.10, ans, data.table(a=2:1, b=1:2, a=1:2, b=2:1, a=2:1, b=1:2))
45-
test(12.11, indices(ans), NULL)
43+
test(12.09, ans, data.table(a=2:1, b=1:2, a=1:2, b=2:1, a=2:1, b=1:2))
44+
test(12.10, indices(ans), NULL)
4645
})
4746
## recycling, first ensure cbind recycling that we want to match to
48-
test(12.12, cbind(data.table(x=integer()), data.table(a=1:2)), data.table(x=c(NA_integer_, NA), a=1:2))
49-
test(12.13, cbind(data.table(x=1L), data.table(a=1:2)), data.table(x=c(1L, 1L), a=1:2))
50-
test(12.14, cbindlist(list(data.table(a=integer()), data.table(b=1:2))), error="Recycling.*not yet implemented")
51-
test(12.15, cbindlist(list(data.table(a=1L), data.table(b=1:2))), error="Recycling.*not yet implemented")
52-
test(12.16, setcbindlist(list(data.table(a=integer()), data.table(b=1:2))), error="have to have the same number of rows")
53-
test(12.17, setcbindlist(list(data.table(a=1L), data.table(b=1:2))), error="have to have the same number of rows")
47+
test(12.11, cbind(data.table(x=integer()), data.table(a=1:2)), data.table(x=c(NA_integer_, NA), a=1:2))
48+
test(12.12, cbind(data.table(x=1L), data.table(a=1:2)), data.table(x=c(1L, 1L), a=1:2))
49+
test(12.13, cbindlist(list(data.table(a=integer()), data.table(b=1:2))), error="Recycling.*not yet implemented")
50+
test(12.14, cbindlist(list(data.table(a=1L), data.table(b=1:2))), error="Recycling.*not yet implemented")
51+
test(12.15, setcbindlist(list(data.table(a=integer()), data.table(b=1:2))), error="have to have the same number of rows")
52+
test(12.16, setcbindlist(list(data.table(a=1L), data.table(b=1:2))), error="have to have the same number of rows")
5453

5554
## retain indices
5655
local({
@@ -63,10 +62,10 @@ local({
6362
setkeyv(l[[1L]], "id1"); setindexv(l[[1L]], list("id1", "id2", "id3", c("id1","id2","id3"))); setindexv(l[[3L]], list("id6", "id7")); setindexv(l[[4L]], "id9")
6463
ii = lapply(l, indices)
6564
ans = cbindlist(l)
66-
test(13.01, key(ans), "id1")
67-
test(13.02, indices(ans), c("id1", "id2", "id3", "id1__id2__id3", "id6", "id7", "id9"))
68-
test(13.03, ii, lapply(l, indices)) ## this tests that original indices have not been touched, shallow_duplicate in mergeIndexAttrib
65+
test(13.1, key(ans), "id1")
66+
test(13.2, indices(ans), c("id1", "id2", "id3", "id1__id2__id3", "id6", "id7", "id9"))
67+
test(13.3, ii, lapply(l, indices)) ## this tests that original indices have not been touched, shallow_duplicate in mergeIndexAttrib
6968
})
70-
test(13.04, cbindlist(list(data.table(a=1:2), data.table(b=3:4, key="b"))), data.table(a=1:2, b=3:4, key="b"))
69+
test(13.4, cbindlist(list(data.table(a=1:2), data.table(b=3:4, key="b"))), data.table(a=1:2, b=3:4, key="b"))
7170
# TODO(#7116): this could be supported
72-
# test(13.05, cbindlist(list(data.table(a=1:2, key="a"), data.table(b=3:4, key="b"))), data.table(a=1:2, b=3:4, key=c("a", "b")))
71+
# test(13.5, cbindlist(list(data.table(a=1:2, key="a"), data.table(b=3:4, key="b"))), data.table(a=1:2, b=3:4, key=c("a", "b")))

0 commit comments

Comments
 (0)