Open
Conversation
be60b48 to
5a3cad0
Compare
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the invariant test suite and refactors parts of the invariant implementation to improve validation, typing, and uncertainty handling.
Changes:
- Replaced legacy
unittest-style invariant tests withpytest-based equivalents and shared fixtures. - Added new uncertainty-propagation tests (closed-form checks + hardcoded “oracle” snapshots).
- Refactored
invariant.pywith typing/ABCs, vectorized q* integration/uncertainty, and improved error handling/logging.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/sas/sascalc/invariant/invariant.py |
Refactors invariant core (typing/ABC, vectorized integration, logging, stricter validation). |
test/sasinvariant/conftest.py |
Adds shared pytest fixtures for synthetic and real invariant datasets. |
test/sasinvariant/CalculatorTest.py |
Pytest port + expanded calculator behavior/validation tests. |
test/sasinvariant/LinearTest.py |
Pytest port for extrapolator/linearization tests + additional edge cases. |
test/sasinvariant/ExtrapolationTest.py |
Pytest port for Guinier/power-law extrapolation behavior. |
test/sasinvariant/UseCasesTest.py |
Pytest port of “usage perspective” scenarios using bundled data files. |
test/sasinvariant/UncertaintyTest.py |
New closed-form and hardcoded-value uncertainty tests. |
test/sasinvariant/InvariantMapperTest.py |
New forwarding/adapter tests for invariant_mapper. |
test/sasinvariant/utest_use_cases.py |
Removed legacy unittest-based use case tests (superseded by pytest suite). |
test/sasinvariant/utest_data_handling.py |
Removed legacy unittest-based data-handling tests (superseded by pytest suite). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+431
to
+433
| def background(self, value: float): | ||
| self._background = value | ||
| self._qstar = None |
Comment on lines
+440
to
+442
| def scale(self, value: float): | ||
| self._scale = value | ||
| self._qstar = None |
8 tasks
2c3e80a to
aeb13ce
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
aeb13ce to
56b3d50
Compare
krzywon
approved these changes
Mar 24, 2026
Contributor
krzywon
left a comment
There was a problem hiding this comment.
Much improved! The switch to pytest is also welcome here. I don't think we have an issue, but switching all tests from unittest should be a goal to remove the dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors and expands the sasinvariant test suite for clarity, consistency, and branch coverage.
utest_*modules to pytest-style test modules.conftest.py.Coverage impact:
invariant.pycoverage increased from 85% to ~99%.invariant_mapper.pycoverage increased from 0% to 100%.How Has This Been Tested?
Ran the tests from the sasinvariant directory and checked the coverage report:
Review Checklist:
Documentation
Installers
Licensing