-
Notifications
You must be signed in to change notification settings - Fork 31
Namespaces: Turn tests back on #841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MImmesberger
merged 124 commits into
namespaces-renamings
from
namespaces-turn-tests-on
Mar 23, 2025
Merged
Changes from 2 commits
Commits
Show all changes
124 commits
Select commit
Hold shift + click to select a range
ddea097
Alphabetically sort test file contents.
MImmesberger 3644285
Break up into tree.
MImmesberger 67778c1
Revert "Break up into tree."
MImmesberger 2d1c53d
Revert "Alphabetically sort test file contents."
MImmesberger 4628269
Merge branch 'namespaces-renamings' into namespaces-turn-tests-on
MImmesberger f92550a
Order test content alphabetically.
MImmesberger 6d5b2aa
Break up into tree.
MImmesberger 31a61aa
Make all unskipped tests run.
MImmesberger 73aef31
Draft new PolicyTest class.
MImmesberger 298cd94
Apply np.array for leafs.
MImmesberger 2dc72d8
Dont destroy group_by_functions.
MImmesberger 5191bb7
Dont round group_by_functions. Dont look for source col for count agg…
MImmesberger 5a4a47b
Fix some wrong qualified names in yaml. Change from entgeltpunkte_zus…
MImmesberger 014c740
Ignore name clashes.
hmgaudecker 8796304
Remove nice names, replace by tuples / tree paths.
hmgaudecker bf59dc0
Revert "Fix some wrong qualified names in yaml. Change from entgeltpu…
MImmesberger 64d70e4
Revert "Break up into tree."
MImmesberger a83dfe3
Temporary solution to work with qualified names in test data.
MImmesberger 108d154
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2012c97
Reapply reverted commit: Fix qualified names.
MImmesberger c4d7be7
Make it possible to use qualified name as source col for aggregation …
MImmesberger 947a9e9
Revert "Make it possible to use qualified name as source col for aggr…
MImmesberger 19d9758
Partly keep changes from last commit: Proper tests of aggregation fun…
MImmesberger 7ca645c
Remove 'nice names' from test.
MImmesberger 4537f53
Use dags commit with Unicode regex.
MImmesberger 8463968
Handle data types for tests.
MImmesberger c2c9697
Add dates_active to Grundrente now because we apply rounding before f…
MImmesberger 6596b22
Make aggregate_by_p_id run.
MImmesberger 6c1a84c
Move back to dags main branch.
MImmesberger b364dcf
Use pd.Series as test inputs.
MImmesberger 96814f5
Updated optree.tree_map (0.14.1) does has tree as positional-only arg…
hmgaudecker 9538a32
Use wohnen namespace for Heizkosten and Bruttokaltmiete.
MImmesberger 27d830a
Use correct argument names for soli and est in alg2.
MImmesberger 15b7c9f
Use correct function name in vorrangprüfungen.
MImmesberger d104d4b
Use pd Series for data checks, use np.array for TT calculations.
MImmesberger 9ffa7df
Update precision and use kind instead of kindergeld__grundsätzlich_an…
MImmesberger 733b130
Some more typos in function arg definitions.
MImmesberger f1461f9
Add test that annotations are applied to derived function. Currently …
MImmesberger d677bbc
Activate all tests, draft of new test file for each.
MImmesberger 75d0d02
Fix interface error matches.
MImmesberger 4e76a2f
Use dags function directly.
hmgaudecker 50874c9
Don't use as a decorator.
hmgaudecker 49900a6
Time to turn mypy on...
hmgaudecker 6b289eb
vertrauenss -> vertrauensschutzprüfung
MImmesberger e36c630
Fix bug that caused data conversion to fail for all DerivedFunctions.
MImmesberger d20b9ed
Revert to old implementation of Abgeltungssteuer, see issue 843.
MImmesberger 7a08303
Add jüngstes_kind_oder_mehrling function and fix some typos.
MImmesberger 50e806c
Use correct file name for demographics test.
MImmesberger 027d347
Fix some typos in EM Renten module.
MImmesberger 9da85ce
Add rounding specs if missing.
MImmesberger a3b4d7b
Use the most recent dags, unify flatten operations (#844)
hmgaudecker 2cf23fa
Remove _m _y that refer to counting months or years.
MImmesberger 413d06f
test.test_file -> test.path.
MImmesberger 3a7668c
Rename Anrechnungszeit functions.
MImmesberger 6b84d8b
Forgot to change keyword to path in policy test utils.
MImmesberger daa8e6f
Some typos in Rente module. Also set decimal tolerance to 1.
MImmesberger 1e51b97
Add some more rounding specs.
MImmesberger a95b4be
Use monthly Kapitalerträge in Grundrente.
MImmesberger 2cdd2b3
Add _y_sn to absetzbare_betreuungskosten.
MImmesberger 47578ff
Fix Wohngeld module typos.
MImmesberger 7c07cd9
Fix Vorsorgeaufwendungen.
MImmesberger dfb3926
Unterhaltsvorschuss tests.
MImmesberger edd8417
Fix Unterhalt module.
MImmesberger 28a50c1
Sozialv Beiträge.
MImmesberger ca165fb
Use correct namespace for sozialversicherung__rente__wartezeit_45_jah…
MImmesberger 02ddf28
Reactivate all policy env tests.
MImmesberger 60dc01a
Activate Lohnsteuer tests.
MImmesberger 34497cb
Delete Kinderbonus targets if Kinderbonus is not active.2
MImmesberger 68c0dbb
Fix params key in Grunds im Alter.
MImmesberger b82b8ed
Make all groupings tests run.
MImmesberger 2187879
Allow for non-typed functions, e.g. if provided by user.
MImmesberger 4725eea
Fix Grundrente tests.
MImmesberger 48f5d6f
Rename all tests dirs.
MImmesberger dd2a7e4
Make full_taxes_transfers run.
MImmesberger 0eb4d33
Simplify test structure.
MImmesberger d0c7b36
Triviality: Make sure dt is only ever used for dags.tree
hmgaudecker 0f6274b
Some small review comments and move Abgeltungssteuer into Einnkommens…
MImmesberger 3eae81a
Go through all callable names in Sozialversicherung dir.
MImmesberger 27a4c7a
Restructure Vorsorgeaufwendungen.
MImmesberger 284f61a
Merge branch 'namespaces-turn-tests-on' of https://github.com/iza-ins…
MImmesberger 6e8f768
Use _y again in Vorsorgeaufwendungen.
MImmesberger 10d5931
Some indentations in test files.
MImmesberger 5d7641f
Update Vorsorgeaufwand structure.
MImmesberger 176d1bb
Forgot renamings in one module.
MImmesberger fe5b6d2
Update zve test file name.
MImmesberger 7355a4d
Rename function that shouldnt fall under time conversion.
MImmesberger c2cfaf8
Update docstrings.
MImmesberger 0472406
Use updated dags.
hmgaudecker fc359b0
Move p_id and hh_id to global namespace.
hmgaudecker 79734c4
Final updates so that tests pass (80% checked). Make sure we can pass…
hmgaudecker d7d0a39
Formatting.
hmgaudecker d1a7e1d
Add profiler, tiny updates to dags.
hmgaudecker 9677811
Update compute_taxes_and_transfers docstring.
MImmesberger 002a9f8
Update dags version.
MImmesberger 3913a79
Add test that checks namespaces of derived functions.
MImmesberger 01b51cb
Update dags version.
MImmesberger ab3b121
Start to work on rewriting combine_functions_in_tree module.
MImmesberger a2d9001
Continue working on rewritten draft.
MImmesberger 5e9d4a9
Add annotations to aggregation functions.
MImmesberger 261cfa2
Draft of interface.py.
MImmesberger 26bc513
New separate classes for aggregations and time conversion functions.
MImmesberger 5f86586
Allow for data source cols for derived functions. Delete time convers…
MImmesberger 74af8b2
Update and add combine_function_in_tree tests.
MImmesberger b01c001
combine_functions_in_tree -> combine_functions.
MImmesberger d147444
Make tests in shared.py run.
MImmesberger 148ac21
Update rounding tests.
MImmesberger f830e01
Update interface tests.
MImmesberger 632e666
Fix small bug in _partial_parameters_to_functions.
MImmesberger 628ac95
Fix isinstance checks.
MImmesberger 9f543c8
Fix annotations check.
MImmesberger 5e4f67a
Renamings to make function interface clearer.
MImmesberger 702cd70
Correct typo in test file and revert last commit.
MImmesberger 923c0d7
Use QualName terminology from dags package, rename gettsim_typing to …
hmgaudecker 78bf648
Simplify typing.
hmgaudecker 2bbf183
Apply small renaming suggestions.
MImmesberger 842b77b
Make TYPES_INPUT_VARIABLES a nested structure.
MImmesberger ccc9ab6
Renamings related to Rente.
MImmesberger 9f21822
Test whether loader can handle policy functions in top-level namespace.
MImmesberger 9d7a640
Apply reordering of namespaces suggestions.
MImmesberger 4707dfb
Fix some namespace typos.
MImmesberger 14508a1
Fix infrastructure to allow for aggregations sources from outside of …
MImmesberger 2ce52a0
Apply all start_date decorators in Grundrente module.
MImmesberger 5efedc1
Formatting, comment.
hmgaudecker 97447d3
Cosmetics.
hmgaudecker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,51 @@ | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| import flatten_dict | ||
| import pytest | ||
| from pandas.testing import assert_series_equal | ||
|
|
||
| from _gettsim.interface import compute_taxes_and_transfers | ||
| from _gettsim_tests._helpers import cached_set_up_policy_environment | ||
| from _gettsim_tests._policy_test_utils import PolicyTestData, load_policy_test_data | ||
| from _gettsim_tests._policy_test_utils import PolicyTest, load_policy_test_data | ||
|
|
||
| if TYPE_CHECKING: | ||
| import datetime | ||
|
|
||
| from _gettsim.gettsim_typing import NestedDataDict, NestedInputStructureDict | ||
|
|
||
| OVERRIDE_COLS = [] | ||
|
|
||
| data = load_policy_test_data("aggregate_by_p_id") | ||
| test_data = load_policy_test_data("aggregate_by_p_id") | ||
|
|
||
|
|
||
| @pytest.mark.xfail(reason="Needs renamings PR.") | ||
| @pytest.mark.parametrize( | ||
| ("test_data", "column"), | ||
| data.parametrize_args, | ||
| ids=str, | ||
| "test", | ||
| test_data, | ||
| ) | ||
| def test_aggregate_by_p_id( | ||
| test_data: PolicyTestData, | ||
| column: str, | ||
| test: PolicyTest, | ||
| ): | ||
| df = test_data.input_df | ||
| environment = cached_set_up_policy_environment(date=test_data.date) | ||
| date: datetime.date = test.date | ||
| input_tree: NestedDataDict = test.input_tree | ||
| expected_output_tree: NestedDataDict = test.expected_output_tree | ||
| target_structure: NestedInputStructureDict = test.target_structure | ||
|
|
||
| environment = cached_set_up_policy_environment(date=date) | ||
|
|
||
| result = compute_taxes_and_transfers( | ||
| data=df, environment=environment, targets=column | ||
| data_tree=input_tree, environment=environment, targets_tree=target_structure | ||
| ) | ||
|
|
||
| assert_series_equal( | ||
| result[column], | ||
| test_data.output_df[column], | ||
| check_dtype=False, | ||
| atol=1e-1, | ||
| rtol=0, | ||
| ) | ||
| flat_result = flatten_dict.flatten(result) | ||
| flat_expected_output_tree = flatten_dict.flatten(expected_output_tree) | ||
|
|
||
| for result_series, expected_series in zip( | ||
| flat_result.values(), flat_expected_output_tree.values() | ||
| ): | ||
| assert_series_equal( | ||
| result_series, | ||
| expected_series, | ||
| check_dtype=False, | ||
| atol=1e-1, | ||
| rtol=0, | ||
| ) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.