Skip to content

Commit d19d1a5

Browse files
committed
avoid arg prefix-completion for versions_end
1 parent edbf1ac commit d19d1a5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

R/archive.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ as_epi_archive <- function(
456456
additional_metadata = NULL,
457457
compactify = NULL,
458458
clobberable_versions_start = NULL,
459-
versions_end = NULL, ...) {
459+
.versions_end = NULL, ...,
460+
versions_end = .versions_end) {
460461
assert_data_frame(x)
461462
x <- rename(x, ...)
462463
x <- guess_column_name(x, "time_value", time_column_names())

tests/testthat/test-archive.R

+18
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ test_that("data.frame must contain geo_value, time_value and version columns", {
1818
)
1919
})
2020

21+
test_that("as_epi_archive custom name mapping works correctly", {
22+
# custom name works correctly
23+
suppressWarnings(expect_equal(
24+
as_epi_archive(rename(dt, weirdName = version), version = weirdName),
25+
as_epi_archive(dt)
26+
))
27+
suppressWarnings(expect_equal(
28+
as_epi_archive(rename(dt, weirdName = geo_value), geo_value = weirdName),
29+
as_epi_archive(dt)
30+
))
31+
suppressWarnings(expect_equal(
32+
as_epi_archive(rename(dt, weirdName = time_value), time_value = weirdName),
33+
as_epi_archive(dt)
34+
))
35+
36+
expect_error(as_epi_archive(rename(dt, weirdName = version), version = weirdName, version = time_value), "Names must be unique")
37+
})
38+
2139
test_that("other_keys can only contain names of the data.frame columns", {
2240
expect_error(as_epi_archive(dt, other_keys = "xyz", compactify = FALSE),
2341
regexp = "`other_keys` must be contained in the column names of `x`."

0 commit comments

Comments
 (0)