Skip to content

Add unit tests for alignPlots() and the getTIS/getRIC/plotTIS/plotRIC family - #50

Merged
zeehio merged 2 commits into
masterfrom
claude/gcims-align-getTIS-plots-coverage
Jul 12, 2026
Merged

Add unit tests for alignPlots() and the getTIS/getRIC/plotTIS/plotRIC family#50
zeehio merged 2 commits into
masterfrom
claude/gcims-align-getTIS-plots-coverage

Conversation

@zeehio

@zeehio zeehio commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

  • alignPlots(): tests the three returned ggplot objects (rt/dt correction plots and the dt_kcorr plot) for labels and expected data, reusing the existing align() fixture in test-align-GCIMSDataset.R.
  • getTIS()/getRIC(): tests the extracted TIS/RIC matrices' shape and SampleID-keyed dimnames.
  • plotTIS()/plotRIC(): tests labels, data, and the dt_range/rt_range and sample= filtering — same "inspect the returned ggplot object, don't render it" strategy used for the other plot functions in Add unit tests for the plotting functions; fix scales >= 1.3.0 compatibility #49.

A useful technique for BiocParallel-forked code

Registering BiocParallel::SerialParam() locally in a test (instead of the default forking MulticoreParam) runs a delayed operation's per-sample step in the same process, letting covr instrument code that would otherwise run invisibly inside a forked worker. Used this for two tests here to unlock coverage on .align_fun_extract()'s dt_kcorr fallback and .extract_RIC_and_TIS_fun_extract() — both were already being exercised by existing/new tests, just invisible to covr until now. This is likely reusable for the similar BiocParallel-fork gaps noted in earlier coverage PRs (e.g. in aaa-class-DelayedDatasetDisk.R).

Brings getTIS_getRIC-GCIMSDataset.R to 100% line coverage, and align-GCIMSDataset.R to 97.5% (116/119) — the remaining 3 lines are the pow package's optional reference-selection call (needs that package installed) and two eval_poly() branches inside alignPlots() that are dead code given its only caller always passes a 2-column matrix.

Overall package coverage: 86.83% → 90.21%.

Test plan

  • Ran both test files individually — all pass
  • Full suite testthat::test_local(".") — 701 passing, 1 pre-existing skip, 0 failures
  • covr::package_coverage() confirms the reported numbers

Generated by Claude Code

claude added 2 commits July 12, 2026 04:28
… family

- alignPlots(): tests the three returned ggplot objects (rt/dt correction
  plots and the dt_kcorr plot) for labels and expected data, using the
  align() fixture already in this file.
- getTIS()/getRIC(): tests the extracted TIS/RIC matrices' shape and
  SampleID-keyed dimnames.
- plotTIS()/plotRIC(): tests labels, data, and the dt_range/rt_range and
  sample= filtering, following the same "inspect the returned ggplot
  object, don't render it" strategy used for the other plot functions.

Registering BiocParallel::SerialParam() locally in two tests (instead of
the default forking MulticoreParam) runs the per-sample delayed operation
in the same process, letting covr instrument .align_fun_extract()'s
dt_kcorr fallback and .extract_RIC_and_TIS_fun_extract() -- both already
exercised by existing/new tests, just invisible to covr inside a forked
worker until now.

Brings getTIS_getRIC-GCIMSDataset.R to 100% line coverage, and
align-GCIMSDataset.R to 97.5% (116/119) -- the remaining 3 lines are the
"pow" package's optional reference-selection call (needs that package
installed) and two eval_poly() branches inside alignPlots() that are dead
code given its only caller always passes a 2-column matrix. Overall
package coverage: 86.83% -> 90.21%.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019V3CHRGSzcEu3k6tpUFv56
Registers BiocParallel::SerialParam() locally in tests that exercise
realize_one_sample_disk()/realize_one_sample_ram(), which normally run
inside forked bpmapply() workers invisible to covr. Adds direct unit
tests of realize_one_sample_disk() for the file.copy fallback path
(unreachable via the public API), mocked file.copy()/unlink() failures
in updateScratchDir()/subset(), and R6-private-access tests for the
directory-vanished and no-pending-ops edge cases. Also covers
DelayedDatasetRAM's unnamed-samples-list guard, sampleNames<-
length-mismatch guard, and the wrong-return-class abort, plus
DelayedDatasetBase's realize() reentrancy guard.
@zeehio
zeehio merged commit 28fb074 into master Jul 12, 2026
1 check passed
@zeehio
zeehio deleted the claude/gcims-align-getTIS-plots-coverage branch July 12, 2026 06:29
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.

2 participants