Skip to content

Commit 9a451b0

Browse files
committed
avoid arg prefix-completion for versions_end
1 parent f31bf71 commit 9a451b0

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
@@ -455,7 +455,8 @@ as_epi_archive <- function(
455455
additional_metadata = NULL,
456456
compactify = NULL,
457457
clobberable_versions_start = NULL,
458-
versions_end = NULL, ...) {
458+
.versions_end = NULL, ...,
459+
versions_end = .versions_end) {
459460
assert_data_frame(x)
460461
x <- rename(x, ...)
461462
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)