Skip to content

Overhaul active learning unit tests to use real components and pytest-mock#543

Open
smcolby wants to merge 1 commit into
mainfrom
test/active-learning-overhaul
Open

Overhaul active learning unit tests to use real components and pytest-mock#543
smcolby wants to merge 1 commit into
mainfrom
test/active-learning-overhaul

Conversation

@smcolby
Copy link
Copy Markdown
Contributor

@smcolby smcolby commented May 6, 2026

Summary

Rewrites the active learning unit test suite to conform to the new unit test standards.

Changes

  • test_acquisition.py (new) — validates each acquisition function (max_uncertainty_reduction, exploitation, probability_improvement,
    expected_improvement, upper_confidence_bound) against its explicit mathematical formula using synthetic numpy arrays; verifies all shorthand
    aliases map to the correct implementations
  • test_active_learning.py (refactored) — replaces integration-style tests that loaded real anvil models from disk with lightweight
    synthetic data and DummyRegressorModel; covers committee query/predict, calibration (isotonic regression + scaling factor), save/load and
    serialize/deserialize round-trips, and uncertainty calibration plots; uses assert_allclose throughout
  • test_ensemble_base.py (new) — covers get_ensemble_class for a valid key and raises ValueError for an unknown key

…-mock

- Add test_acquisition.py: validates each acquisition function against
  its mathematical formula using numpy arrays
- Refactor test_active_learning.py: replace integration-style tests
  (loading real anvil models from disk) with lightweight synthetic data
  and DummyRegressorModel; assert actual calibration math and mutual-
  exclusion properties; use pytest.approx / assert_allclose throughout
- Add test_ensemble_base.py: covers get_ensemble_class success and
  invalid-type error paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@smcolby smcolby self-assigned this May 6, 2026
@smcolby smcolby requested a review from hmacdope May 6, 2026 07:45
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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