Skip to content

Add testthat coverage for v0.13 dataset options and data access#37

Merged
jefferis merged 2 commits into
masterfrom
copilot/add-metadata-tests-v0-13-dataset
Apr 29, 2026
Merged

Add testthat coverage for v0.13 dataset options and data access#37
jefferis merged 2 commits into
masterfrom
copilot/add-metadata-tests-v0-13-dataset

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

The v0.13 dataset changed how choose_mcns resolves server/rootnode (now pulled from the CNS Clio entry rather than hardcoded), warranting explicit test coverage for both the option values it sets and live data retrieval.

New tests (tests/testthat/test-dataset.R)

  • choose_mcns v0.9 — verifies hardcoded server, rootnode, neuprint URL, and dataset name; runs without Clio auth
  • choose_mcns v0.13 — verifies malevnc.dataset, malevnc.neuprint_dataset, malevnc.neuprint = https://neuprint-cns.janelia.org, and that server/rootnode are non-empty Clio-derived values; skipped if no Clio credentials
  • Body annotations pull (v0.13)mcns_body_annotations(query=list(superclass="descending_neuron")) inside with_mcns(..., dataset="male-cns:v0.13"); skipped if no Clio
  • Neuprint metadata pull (v0.13)mcns_neuprint_meta("/LAL04[12]") inside with_mcns(..., dataset="male-cns:v0.13"); skipped if no Clio

Clio-dependent tests use a local has_clio() guard so they degrade gracefully in environments without credentials.

Agent-Logs-Url: https://github.com/natverse/malecns/sessions/abc43a35-3149-4325-a20d-9aacbeafbd1f

Co-authored-by: jefferis <23763+jefferis@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit testthat coverage for dataset option resolution and live data access paths introduced/changed for the male-cns:v0.13 snapshot, including Clio-derived server/rootnode handling and neuprint/clio query sanity checks.

Changes:

  • Add has_clio() guard to conditionally run Clio-dependent tests when credentials are available.
  • Add tests asserting choose_mcns() option values for male-cns:v0.9 (hardcoded) and male-cns:v0.13 (Clio-derived + patched neuprint settings).
  • Add integration-style tests that fetch body annotations and neuprint metadata while targeting male-cns:v0.13.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +32
res <- with_mcns(
mcns_body_annotations(query = list(superclass = "descending_neuron")),
dataset = "male-cns:v0.13"
)
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The with_mcns(..., dataset = "male-cns:v0.13") wrapper isn’t currently asserted to have taken effect. If with_mcns() stops updating options(malecns.dataset) (or otherwise fails to switch datasets), this test could still pass by successfully querying the default dataset (likely v0.9) because it only checks that a non-empty data.frame comes back. Consider asserting inside the with_mcns evaluation that the active dataset/options are actually male-cns:v0.13 (e.g., via getOption("malecns.dataset") or choose_mcns(set=FALSE)$malevnc.dataset) before/while making the call.

Copilot uses AI. Check for mistakes.
test_that("can pull neuprint metadata from v0.13 dataset", {
skip_if_not(has_clio(), "Clio credentials not available")
res <- with_mcns(
mcns_neuprint_meta("/LAL04[12]"),
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the body-annotations test, this only asserts that some metadata is returned, not that the query actually ran against male-cns:v0.13. If dataset switching regresses, the test could still pass against the default dataset. Consider adding an assertion within the with_mcns call that the active dataset/options are male-cns:v0.13 while mcns_neuprint_meta() executes.

Suggested change
mcns_neuprint_meta("/LAL04[12]"),
{
expect_equal(getOption("malevnc.dataset"), "male-cns:v0.13")
expect_equal(getOption("malevnc.neuprint_dataset"), "male-cns:v0.13")
mcns_neuprint_meta("/LAL04[12]")
},

Copilot uses AI. Check for mistakes.
Comment thread tests/testthat/test-dataset.R
@jefferis jefferis merged commit f431737 into master Apr 29, 2026
2 checks passed
@jefferis jefferis deleted the copilot/add-metadata-tests-v0-13-dataset branch April 29, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants