Add testthat coverage for v0.13 dataset options and data access#37
Conversation
Agent-Logs-Url: https://github.com/natverse/malecns/sessions/abc43a35-3149-4325-a20d-9aacbeafbd1f Co-authored-by: jefferis <23763+jefferis@users.noreply.github.com>
There was a problem hiding this comment.
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 formale-cns:v0.9(hardcoded) andmale-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.
| res <- with_mcns( | ||
| mcns_body_annotations(query = list(superclass = "descending_neuron")), | ||
| dataset = "male-cns:v0.13" | ||
| ) |
There was a problem hiding this comment.
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.
| 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]"), |
There was a problem hiding this comment.
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.
| 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]") | |
| }, |
The v0.13 dataset changed how
choose_mcnsresolves 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_mcnsv0.9 — verifies hardcoded server, rootnode, neuprint URL, and dataset name; runs without Clio authchoose_mcnsv0.13 — verifiesmalevnc.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 credentialsmcns_body_annotations(query=list(superclass="descending_neuron"))insidewith_mcns(..., dataset="male-cns:v0.13"); skipped if no Cliomcns_neuprint_meta("/LAL04[12]")insidewith_mcns(..., dataset="male-cns:v0.13"); skipped if no ClioClio-dependent tests use a local
has_clio()guard so they degrade gracefully in environments without credentials.