tests/testthat/test_data_fetcher.R

# Testing data_fetcher
test_that("data_fetcher returns correct structure", {
  properties <- list(
    rcsb_id = list(),
    chem_comp = list("type", "formula_weight", "name", "formula"),
    rcsb_chem_comp_info = list("initial_release_date")
  )

  ids <- c("NAG", "EBW")

  result <- data_fetcher(
    id = ids,
    data_type = "CHEMICAL_COMPONENT",
    properties = properties,
    return_as_dataframe = TRUE
  )

  expect_type(result, "list")
  expect_true("rcsb_id" %in% names(result))
  expect_equal(result$rcsb_id, ids)
})

Try the rPDBapi package in your browser

Any scripts or data that you put into this service are public.

rPDBapi documentation built on Oct. 19, 2024, 5:08 p.m.