Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit fd98437

Browse files
committed
Fix tests
1 parent 0e0fc5f commit fd98437

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ importFrom(purrr,map)
5050
importFrom(purrr,map_int)
5151
importFrom(purrr,pmap_chr)
5252
importFrom(purrr,reduce)
53+
importFrom(purrr,set_names)
5354
importFrom(purrr,transpose)
5455
importFrom(rlang,.data)
5556
importFrom(stats,setNames)

R/dev.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ upload_swift = function(source, container, name = basename(source), credential_i
6565
#' @param version The version for the new metadata as a character scalar, e.g.
6666
#' "0.2.3"
6767
#' @inheritDotParams upload_swift
68-
#' @example
68+
#' @examples
6969
#' \dontrun{
7070
#' metadata = CuratedAtlasQueryR::get_metadata() |> head(10) |> dplyr::collect()
7171
#' update_database(metadata, "0.2.3", credential_id = "ABCDEFGHIJK", credential_secret = "ABCD1234EFGH-5678IJK")

R/query.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,13 @@ get_metadata <- function(
458458
#' @param dataset_ids A character vector, where each entry is a dataset ID
459459
#' obtained from the `$dataset_id` column of the table returned from
460460
#' [get_metadata()]
461-
#' @return
461+
#' @importFrom purrr map set_names
462+
#' @importFrom glue glue
463+
#' @importFrom DBI dbConnect
464+
#' @importFrom duckdb duckdb
465+
#' @importFrom dplyr tbl
466+
#' @return A named list, where each name is a dataset ID, and each value is
467+
#' a "lazy data frame", ie a `tbl`.
462468
#' @export
463469
#' @examples
464470
#' dataset_id = "838ea006-2369-4e2c-b426-b2a744a2b02b"
@@ -474,11 +480,11 @@ get_unharmonised_metadata = function(
474480
unharmonised_root <- file.path(cache_directory, COUNTS_VERSION, "unharmonised")
475481
duck = duckdb() |> dbConnect(drv = _, read_only = TRUE)
476482
dataset_ids |>
477-
purrr::set_names() |>
478-
purrr::map(function(dataset_id){
483+
set_names() |>
484+
map(function(dataset_id){
479485
file_name = glue::glue("{dataset_id}.parquet")
480486
local_path = file.path(unharmonised_root, file_name)
481-
glue::glue("{remote_url}/{file_name}") |>
487+
glue("{remote_url}/{file_name}") |>
482488
sync_remote_file(
483489
local_path,
484490
progress(type = "down", con = stderr())

tests/testthat/test-query.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ test_that("get_unharmonised_metadata works with one ID", {
162162
unharmonised_meta = get_unharmonised_metadata(dataset_id)
163163
unharmonised_tbl = unharmonised_meta[[dataset_id]]
164164

165-
expect_s3_class(unharmonised_meta, "list")
165+
expect_type(unharmonised_meta, "list")
166166
expect_s3_class(unharmonised_tbl, "tbl")
167167
})
168168

169169
test_that("get_unharmonised_metadata works with multiple IDs", {
170-
dataset_ids = c("838ea006-2369-4e2c-b426-b2a744a2b02b", "83b9cb97-9ee4-404d-8cdf-ccede8235356.parquet")
170+
dataset_ids = c("838ea006-2369-4e2c-b426-b2a744a2b02b", "83b9cb97-9ee4-404d-8cdf-ccede8235356")
171171
unharmonised_meta = get_unharmonised_metadata(dataset_ids)
172172

173173
expect_equal(names(unharmonised_meta), dataset_ids)
174-
})
174+
})

0 commit comments

Comments
 (0)