Repository navigation
Test enum and string values in household calculations without axes - #4148
Merged
Merged
Conversation
Since the SPM country tests moved to stand-in simulations, no unit test reached the Enum and str branches of PolicyEngineCountry.calculate for a household without axes. A stand-in simulation now calculates one variable of each kind, and the test checks that the result holds the enum member's name and a plain str. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4148 +/- ##
===========================================
+ Coverage 50.63% 88.11% +37.47%
===========================================
Files 258 285 +27
Lines 14955 16577 +1622
Branches 2399 2712 +313
===========================================
+ Hits 7573 14607 +7034
+ Misses 6751 1292 -5459
- Partials 631 678 +47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously deployed
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.
Fixes #4147
Summary
PolicyEngineCountry.calculateformats each value of a household calculation without axes by the variable'svalue_type. Since Make the SPM country tests unit tests, with two integration tests against the installed US model #4136 moved the SPM country tests onto stand-in simulations, every unit test that calls it uses float or int variables, so no test reached theEnumbranch (result.decode()[entity_index].name) or thestrbranch (str(result[entity_index])).codecov/projectfell 0.03 points on Make the SPM country tests unit tests, with two integration tests against the installed US model #4136.TestHouseholdCalculationgainstest__calculate_returns_enum_names_and_plain_strings_without_axes, parametrized over an enum variable and a string variable. A stand-in simulation returns anEnumArrayof the module'sExampleEnumor a NumPy string array, as the neighbouring tests stand in for_create_simulation. The test checks that the household cell holds the enum member's name ("SECOND") or the string, as a plainstr._serialize_axis_resulttests.Testing
calculate'sEnumandstrbranches executed.ruff format --checkandruff checkon the changed test module,mypy(its configured files), and.github/scripts/check_changelog_fragment.shagainstmaster: all pass.🤖 Generated with Claude Code