policyengine-core 3.36.0__tar.gz → 3.36.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/CHANGELOG.md +14 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/PKG-INFO +1 -1
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/populations/population.py +15 -2
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/microsimulation.py +8 -2
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/simulation.py +18 -3
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/simulation_builder.py +11 -3
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/pyproject.toml +1 -1
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_apply_reform_holders_property.py +2 -2
- policyengine_core-3.36.2/tests/core/test_microsimulation_calculate_signatures.py +86 -0
- policyengine_core-3.36.2/tests/core/test_microsimulation_option_reads.py +221 -0
- policyengine_core-3.36.2/tests/core/test_microsimulation_option_reads_property.py +172 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_reform_baseline_system.py +8 -1
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_simulations.py +176 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_storage_input_index.py +3 -1
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_storage_shared_index.py +4 -2
- policyengine_core-3.36.2/tests/fixtures/microsimulation_option_reads.py +381 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/set_input_helper_order.py +3 -3
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/ISSUE_TEMPLATE.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/actionlint.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/bump_version.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/changelog_template.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/get-changelog-diff.sh +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/has-functional-changes.sh +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/is-version-number-acceptable.sh +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/publish-git-tag.sh +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/requirements/legacy-country-smoke.txt +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/workflows/pr.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.github/workflows/push.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.gitignore +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/.python-version +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/AGENTS.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/CLAUDE.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/CONTRIBUTING.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/LICENSE +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/MANIFEST.in +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/Makefile +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/README.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/_build/logs/myst.build.json +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/changelog.d/.gitkeep +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/_config.yml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/_static/style.css +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/_toc.yml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/add_plotly_to_book.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/contributing/intro.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/engineering/skills/README.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/engineering/skills/documentation_review.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/engineering/skills/github-prs.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/engineering/skills/testing.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/intro.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/logo.png +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/commons.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/country_template.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/data.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/data_storage.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/entities.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/enums.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/errors.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/experimental.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/extension_template.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/holders.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/parameters.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/periods.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/populations.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/projectors.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/reforms.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/scripts.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/simulations.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/taxbenefitsystems.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/taxscales.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/tools.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/tracers.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/types.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/variables.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/python_api/warnings.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/branches.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/country.ipynb +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/datasets.ipynb +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/parameters.md +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/reforms.ipynb +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/docs/usage/simulation.ipynb +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/mypy.ini +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/build_metadata.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/charts/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/charts/bar.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/charts/formatting.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/commons/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/commons/formulas.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/commons/misc.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/commons/rates.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/constants.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/data/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/data/datasets/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/data/datasets/country_template_dataset.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/entities.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/modelled_policies.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/benefits/basic_income.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/benefits/housing_allowance.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/benefits/index.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/benefits/parenting_allowance/amount.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/benefits/parenting_allowance/income_threshold.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/general/age_of_majority.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/general/age_of_retirement.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/taxes/housing_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/taxes/income_tax_rate.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/parameters/taxes/social_security_contribution.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/add_dynamic_variable.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/add_new_tax.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/flat_social_security_contribution.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/modify_social_security_taxation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/reforms/removal_basic_income.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/situation_examples/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/situation_examples/couple.json +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/situation_examples/housing.json +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/situation_examples/single.json +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/age.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/basic_income.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/disposable_income.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/housing_allowance.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/housing_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/income_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/reforms/add_dynamic_variable.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/reforms/add_new_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/reforms/modify_social_security_taxation.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/situations/income_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/situations/parenting_allowance.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/social_security_contribution.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/tests/test_microsimulation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/benefits.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/demographics.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/housing.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/ids.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/income.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/stats.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/country_template/variables/taxes.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data/dataset.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/in_memory_storage.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/on_disk_storage.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/storage_directory.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/storage_keys.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_storage/store_history.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_structures/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_structures/parameter_metadata.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_structures/parameter_node_metadata.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_structures/reference.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/data_structures/unit.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/entities/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/entities/entity.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/entities/group_entity.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/entities/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/entities/role.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/enums/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/enums/config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/enums/enum.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/enums/enum_array.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/cycle_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/empty_argument_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/nan_creation_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/non_deterministic_formula_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/parameter_not_found_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/parameter_parsing_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/period_mismatch_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/situation_parsing_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/spiral_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/variable_name_conflict_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/errors/variable_not_found_error.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/experimental/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/experimental/memory_config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/local_benefit.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/parameters/local_town/child_allowance/amount.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/parameters/local_town/child_allowance/index.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/parameters/local_town/index.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/extension_template/tests/local_benefit.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/holders/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/holders/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/holders/holder.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/model_api.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/at_instant_like.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/get_parameter.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/homogenize_parameters.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/interpolate_parameters.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/propagate_parameter_metadata.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/operations/uprate_parameters.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter_at_instant.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter_node.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter_node_at_instant.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/parameter_scale_bracket.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/parameters/vectorial_parameter_node_at_instant.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/periods/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/periods/config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/periods/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/periods/instant_.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/periods/period_.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/populations/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/populations/config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/populations/group_population.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/entity_to_person_projector.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/first_person_to_entity_projector.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/projector.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/projectors/unique_role_to_entity_projector.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/reforms/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/reforms/reform.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/assets/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/assets/index.html +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/policyengine_command.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/run_data.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/run_test.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/scripts/simulation_generator.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/individual_sim.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/simulation_macro_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxbenefitsystems/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxbenefitsystems/tax_benefit_system.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/abstract_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/abstract_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/amount_tax_scale_like.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/linear_average_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/marginal_amount_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/marginal_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/rate_tax_scale_like.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/single_amount_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/taxscales/tax_scale_like.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/google_cloud.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/hugging_face.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/simulation_dumper.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/test_from_situation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/test_runner.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tools/win_file_manager.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/computation_log.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/flat_trace.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/full_tracer.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/performance_log.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/simple_tracer.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/trace_node.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/tracing_parameter_node_at_instant.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/tracers/variable_graph.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/types/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/types/data_types/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/types/data_types/arrays.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/config.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/defined_for.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/formula_randomness.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/helpers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/typing.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/variables/variable.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/warnings/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/warnings/libyaml_warning.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/warnings/memory_config_warning.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/warnings/parameter_key_warning.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/warnings/tempfile_warning.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/pytest.ini +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/conftest.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/test_between_function.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/test_formulas.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/test_is_in_function.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/test_random_seed.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/commons/test_rates.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/data/test_dataset.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/enums/test_enum.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/model_api/test_index_.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/array_type.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/duplicate_key.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/filesystem_hierarchy/empty_index_file/index.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/filesystem_hierarchy/node1/param.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/indentation.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/missing_value.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/parameter_for_unit_propagation.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/test_parameter_clone.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/test_parameter_validation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/test_propagate_units.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/test_unknown_keys.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/unexpected_key_in_parameter.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/unexpected_key_in_scale.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/unexpected_key_in_value_at_instant.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/unexpected_key_in_value_history.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/unknown_key_beside_values.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/uprating_under_metadata.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_date.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_scale.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_type_in_bracket.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_type_in_brackets.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_type_in_parameter.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_type_in_scale.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_type_in_value_history.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/wrong_value.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameter_validation/yaml_hierarchy/node1.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_base_uprating.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_base_uprating_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_interpolation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_nesting.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_propagation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_scale_threshold_uprating.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/operations/test_uprating.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/test_numpy2_structured_arrays.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/test_parameter_metadata_clone.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/test_parameter_metadata_clone_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/test_vectorial_parameter_node_copy.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters/test_vectorial_parameter_node_copy_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/bareme.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/local_tax.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/rate.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/test_fancy_indexing.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/parameters_fancy_indexing/test_fancy_indexing_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/simulations/test_formula_randomness_concurrency.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_abstract_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_abstract_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_linear_average_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_linear_average_rate_tax_scale_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_marginal_amount_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_marginal_rate_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_rate_scale_conversion_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_rate_tax_scale_like.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_single_amount_tax_scale.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tax_scales/test_tax_scales_commons.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_apply_reform_holders.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_apply_reform_invalidates_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_apply_reform_preserves_user_inputs.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_assert_near_precision.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_axes.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_bincount_minlength.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_helper_invalidation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_input_fixed_point.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_input_fixed_point_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_input_invalidation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_input_invalidation_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_scoped_delete_arrays.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_shared_arrays.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_branch_shared_arrays_differential.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_build_metadata.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_calculate_output.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_carry_over_order.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_carry_over_order_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_clone_invalidated_caches.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_clone_rebinding.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_clone_rebinding_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_clone_reform_baseline.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_clone_reform_baseline_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_countries.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_cycles.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_data_storage_dir.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_data_storage_dir_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dataset_default_role.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dataset_default_role_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dataset_getattr.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dataset_unknown_column_warning.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_default_simulation_count_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_disk_period_filenames.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_disk_storage_delete_contained_periods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_disk_storage_delete_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_disk_storage_differential.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_disk_storage_ownership.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_docs_deployment.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dump_restore.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_dump_restore_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_entities.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_eternity_subperiods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_extensions.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_fast_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_fast_cache_contained_periods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_fast_cache_contained_periods_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_fast_cache_guards.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_formulas.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_group_population_empty.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_group_population_reductions_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_holder_branch_fallback.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_holder_write_fast_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_holder_write_fast_cache_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_holders.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_input_tier_invalidation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_join_with_persons_identity.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_join_with_persons_identity_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_known_periods_branch_visibility.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_known_periods_branch_visibility_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_macro_cache_not_singleton.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_medium_fixes.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_microsimulation_person_accessor.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_microsimulation_weights.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_on_disk_storage_clones.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_opt_out_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_option_result_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_option_result_cache_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_option_result_input_provenance.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_own_period_input_overlapping_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_pandas3_compatibility.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_parameter_security.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_parameters.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_periods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_projectors.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_reform_parameter_isolation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_reform_period_keys.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_reforms.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_registered_input_deletion.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_release_tagging.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_rerun_fixture_isolation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_restore_input_provenance.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_restore_input_registry.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_restore_input_registry_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_set_input_helper_order.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_set_input_helper_order_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_simulation_builder.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_simulation_copy_pickle.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_simulation_copy_pickle_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_stable_hash_seed.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_stale_frame_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_storage_anchored_periods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_storage_delete_branch.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_storage_shared_index_differential.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_baseline_branch.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_computed_values.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_computed_values_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_deleted_inputs.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_entity_weight_totals.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_inputs_only.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_inputs_only_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_invalidates_cache.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_membership_ids.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_restore_inputs.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_sampling_period.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_sampling_period_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_structural_ids.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_subsample_weight_fallback.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_tax_benefit_system_cache_identity.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_tracers.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_tracing_parameter_isolation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_tracing_parameter_isolation_properties.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_uprating_order.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_uprating_order_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_user_input_keys.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_user_input_keys_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_user_input_keys_soundness.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_variable_code_sharing.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_variable_code_sharing_property.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_yaml.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/test_assert_near.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/test_google_cloud.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/test_hugging_face.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/test_runner/test_gc_pause.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/tools/test_runner/test_yaml_runner.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_adds.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_annualize.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_bounds.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_defined_for.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_formula_randomness.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_non_numeric_uprating_and_defined_for.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_subtracts.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_subtracts_sign.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_variable_clone.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_variable_formula_determinism.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_variable_uprating.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/variables/test_variables.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/appclient.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/branch_input_invalidation.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/branch_shared_arrays.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/carry_over.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/chained_uprating_reference.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/data_storage_dir.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/disk_storage.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/entities.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/fast_cache_contained_periods.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/option_caches.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/parameter_metadata_clones.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/reform_holders.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/simulation_copy.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/simulations.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/subsample_inputs.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/taxbenefitsystems.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/tracing.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/uprated_inputs.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/uprating_order.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/variables.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/vectorial_parameter_nodes.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/__init__.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/directory/subdirectory/test_4.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/directory/test_1.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/directory/test_2.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/failing_test_absolute_error_margin.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/failing_test_relative_error_margin.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_absolute_error_margin.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_failure.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_name_filter.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_relative_error_margin.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_success.yml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_with_anchors.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_with_extension.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_with_reform.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/fixtures/yaml_tests/test_with_reform_2.yaml +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/smoke/test_country_init.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/smoke/test_us.py +0 -0
- {policyengine_core-3.36.0 → policyengine_core-3.36.2}/uv.lock +0 -0
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.36.2] - 2026-11-19
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- `Simulation.__init__` and `SimulationBuilder.build_from_dict` now build `input_variables` from recorded inputs without eagerly allocating empty `Holder` objects for every variable in the system, so `memory_config` set after setup applies to holders created afterwards (values can go to disk, and `variables_to_drop` variables are no longer stored).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## [3.36.1] - 2026-11-15
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `Microsimulation.calculate_add` and `calculate_divide` now take `decode_enums`, so a formula that reads a variable with `options=[ADD]` or `options=[DIVIDE]` gets a writable NumPy array in a `Microsimulation`, as in a `Simulation`, instead of a `TypeError`.
|
|
13
|
+
|
|
14
|
+
|
|
1
15
|
## [3.36.0] - 2026-11-13
|
|
2
16
|
|
|
3
17
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: policyengine-core
|
|
3
|
-
Version: 3.36.
|
|
3
|
+
Version: 3.36.2
|
|
4
4
|
Summary: Core microsimulation engine enabling country-specific policy models.
|
|
5
5
|
Project-URL: Homepage, https://github.com/policyengine/policyengine-core
|
|
6
6
|
Author-email: PolicyEngine <hello@policyengine.org>
|
{policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/populations/population.py
RENAMED
|
@@ -2,6 +2,7 @@ import traceback
|
|
|
2
2
|
from typing import TYPE_CHECKING, Any, List, Optional, Container
|
|
3
3
|
|
|
4
4
|
import numpy
|
|
5
|
+
import pandas as pd
|
|
5
6
|
from numpy.typing import ArrayLike
|
|
6
7
|
|
|
7
8
|
from policyengine_core import projectors
|
|
@@ -154,15 +155,27 @@ See more information at <https://openfisca.org/doc/coding-the-legislation/35_per
|
|
|
154
155
|
calculate_kwargs["decode_enums"] = False
|
|
155
156
|
|
|
156
157
|
if config.ADD in options:
|
|
157
|
-
|
|
158
|
+
result = self.simulation.calculate_add(
|
|
158
159
|
variable_name, period, **calculate_kwargs
|
|
159
160
|
)
|
|
160
161
|
elif config.DIVIDE in options:
|
|
161
|
-
|
|
162
|
+
result = self.simulation.calculate_divide(
|
|
162
163
|
variable_name, period, **calculate_kwargs
|
|
163
164
|
)
|
|
164
165
|
else:
|
|
165
166
|
return self.simulation.calculate(variable_name, period, **calculate_kwargs)
|
|
167
|
+
# In a Microsimulation these reads return a MicroSeries. pandas pairs
|
|
168
|
+
# two Series' values by index label, and ``GroupPopulation.project``
|
|
169
|
+
# labels each member's value with its group's position, so combining a
|
|
170
|
+
# projected read with another Series pairs the wrong values or raises.
|
|
171
|
+
# Return a NumPy array, as a Simulation does, and copy it: pandas 3
|
|
172
|
+
# returns a read-only view of a Series' values, and a formula may write
|
|
173
|
+
# to what it reads. ``numpy.array`` copies the values without calling
|
|
174
|
+
# ``MicroSeries.to_numpy`` or ``MicroSeries.values``, and microdf warns
|
|
175
|
+
# on each of those calls that the result carries no weights.
|
|
176
|
+
if isinstance(result, pd.Series):
|
|
177
|
+
return numpy.array(result)
|
|
178
|
+
return result
|
|
166
179
|
|
|
167
180
|
# Helpers
|
|
168
181
|
|
|
@@ -87,8 +87,11 @@ class Microsimulation(Simulation):
|
|
|
87
87
|
period: Period = None,
|
|
88
88
|
map_to: str = None,
|
|
89
89
|
use_weights: bool = True,
|
|
90
|
+
decode_enums: bool = False,
|
|
90
91
|
) -> MicroSeries:
|
|
91
|
-
|
|
92
|
+
# ``Population.__call__`` passes ``decode_enums`` with every ADD or
|
|
93
|
+
# DIVIDE read in a formula.
|
|
94
|
+
values = super().calculate_add(variable_name, period, decode_enums=decode_enums)
|
|
92
95
|
if map_to is not None:
|
|
93
96
|
source_entity = self.tax_benefit_system.get_variable(
|
|
94
97
|
variable_name, check_existence=True
|
|
@@ -105,8 +108,11 @@ class Microsimulation(Simulation):
|
|
|
105
108
|
period: Period = None,
|
|
106
109
|
map_to: str = None,
|
|
107
110
|
use_weights: bool = True,
|
|
111
|
+
decode_enums: bool = False,
|
|
108
112
|
) -> MicroSeries:
|
|
109
|
-
values = super().calculate_divide(
|
|
113
|
+
values = super().calculate_divide(
|
|
114
|
+
variable_name, period, decode_enums=decode_enums
|
|
115
|
+
)
|
|
110
116
|
if map_to is not None:
|
|
111
117
|
source_entity = self.tax_benefit_system.get_variable(
|
|
112
118
|
variable_name, check_existence=True
|
{policyengine_core-3.36.0 → policyengine_core-3.36.2}/policyengine_core/simulations/simulation.py
RENAMED
|
@@ -892,10 +892,25 @@ class Simulation:
|
|
|
892
892
|
self.calc = self.calculate
|
|
893
893
|
self.df = self.calculate_dataframe
|
|
894
894
|
|
|
895
|
+
recorded_input_names = {
|
|
896
|
+
name for name, _branch_name, _period in self._user_input_keys
|
|
897
|
+
}
|
|
898
|
+
if populations is not None:
|
|
899
|
+
# Populations passed in may already hold values this simulation
|
|
900
|
+
# did not record.
|
|
901
|
+
recorded_input_names.update(
|
|
902
|
+
name
|
|
903
|
+
for population in self.populations.values()
|
|
904
|
+
for name, holder in population._holders.items()
|
|
905
|
+
if len(holder.get_known_periods()) > 0
|
|
906
|
+
)
|
|
907
|
+
# A reform may have moved a recorded variable to another entity, leaving
|
|
908
|
+
# its value in a holder this simulation no longer reads.
|
|
895
909
|
self.input_variables = [
|
|
896
|
-
|
|
897
|
-
for variable in self.tax_benefit_system.variables.
|
|
898
|
-
if
|
|
910
|
+
name
|
|
911
|
+
for name, variable in self.tax_benefit_system.variables.items()
|
|
912
|
+
if name in recorded_input_names
|
|
913
|
+
and name in self.populations[variable.entity.key]._holders
|
|
899
914
|
]
|
|
900
915
|
|
|
901
916
|
self.situation_input = situation
|
|
@@ -186,10 +186,18 @@ class SimulationBuilder:
|
|
|
186
186
|
tax_benefit_system, input_dict, simulation
|
|
187
187
|
)
|
|
188
188
|
|
|
189
|
+
# A subclass that replaces ``__init__`` has no record until an input is
|
|
190
|
+
# stored.
|
|
191
|
+
recorded_input_names = {
|
|
192
|
+
name
|
|
193
|
+
for name, _branch_name, _period in getattr(
|
|
194
|
+
simulation, "_user_input_keys", ()
|
|
195
|
+
)
|
|
196
|
+
}
|
|
189
197
|
simulation.input_variables = [
|
|
190
|
-
|
|
191
|
-
for
|
|
192
|
-
if
|
|
198
|
+
name
|
|
199
|
+
for name in simulation.tax_benefit_system.variables
|
|
200
|
+
if name in recorded_input_names
|
|
193
201
|
]
|
|
194
202
|
|
|
195
203
|
return simulation
|
|
@@ -72,7 +72,7 @@ def test_every_existing_holder_uses_its_system_variable(
|
|
|
72
72
|
simulation = build(mask)
|
|
73
73
|
for name in REPLACED:
|
|
74
74
|
population = simulation.get_variable_population(name)
|
|
75
|
-
|
|
75
|
+
population._holders.pop(name, None)
|
|
76
76
|
for name in order:
|
|
77
77
|
simulation.get_holder(name)
|
|
78
78
|
if warm:
|
|
@@ -132,7 +132,7 @@ def test_reform_before_or_after_holder_creation_returns_same_values(
|
|
|
132
132
|
mask, default, warm
|
|
133
133
|
):
|
|
134
134
|
before_holder = build(mask)
|
|
135
|
-
|
|
135
|
+
before_holder.person._holders.pop("award", None)
|
|
136
136
|
after_holder = build(mask)
|
|
137
137
|
if warm:
|
|
138
138
|
after_holder.calculate("award", YEAR)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Each ``Microsimulation`` calculate method takes the arguments ``Simulation``'s takes.
|
|
2
|
+
|
|
3
|
+
``Population.__call__`` sends a formula's read to ``calculate``,
|
|
4
|
+
``calculate_add`` or ``calculate_divide`` with one set of keyword arguments.
|
|
5
|
+
``Microsimulation`` overrides those three methods and ``calculate_dataframe``.
|
|
6
|
+
When an override lacks one of the base method's arguments, Python rejects the
|
|
7
|
+
call with a ``TypeError`` in a ``Microsimulation``, and a ``Simulation``
|
|
8
|
+
computes the same call.
|
|
9
|
+
|
|
10
|
+
Any call that passes its arguments by keyword and binds to a ``Simulation``
|
|
11
|
+
calculate method also binds to the ``Microsimulation`` override. The test
|
|
12
|
+
checks that for every subset of each method's optional arguments.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import inspect
|
|
16
|
+
from itertools import chain, combinations
|
|
17
|
+
|
|
18
|
+
import pytest
|
|
19
|
+
|
|
20
|
+
from policyengine_core.simulations import Microsimulation, Simulation
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def calculate_overrides() -> list:
|
|
24
|
+
"""The ``Simulation`` calculate methods that ``Microsimulation`` overrides."""
|
|
25
|
+
return sorted(
|
|
26
|
+
name
|
|
27
|
+
for name, member in vars(Microsimulation).items()
|
|
28
|
+
if name.startswith("calculate")
|
|
29
|
+
and inspect.isfunction(member)
|
|
30
|
+
and inspect.isfunction(getattr(Simulation, name, None))
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def keyword_calls(name: str) -> list:
|
|
35
|
+
"""Every set of argument names a caller can pass to ``Simulation``'s method."""
|
|
36
|
+
parameters = inspect.signature(getattr(Simulation, name)).parameters.values()
|
|
37
|
+
required = [
|
|
38
|
+
parameter.name
|
|
39
|
+
for parameter in parameters
|
|
40
|
+
if parameter.default is parameter.empty
|
|
41
|
+
]
|
|
42
|
+
optional = [
|
|
43
|
+
parameter.name
|
|
44
|
+
for parameter in parameters
|
|
45
|
+
if parameter.default is not parameter.empty
|
|
46
|
+
]
|
|
47
|
+
subsets = chain.from_iterable(
|
|
48
|
+
combinations(optional, size) for size in range(len(optional) + 1)
|
|
49
|
+
)
|
|
50
|
+
return [(*required, *subset) for subset in subsets]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
CALLS = [
|
|
54
|
+
(name, arguments)
|
|
55
|
+
for name in calculate_overrides()
|
|
56
|
+
for arguments in keyword_calls(name)
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_microsimulation_overrides_the_four_calculate_methods():
|
|
61
|
+
# An empty list would leave the property below with nothing to check.
|
|
62
|
+
assert {
|
|
63
|
+
"calculate",
|
|
64
|
+
"calculate_add",
|
|
65
|
+
"calculate_divide",
|
|
66
|
+
"calculate_dataframe",
|
|
67
|
+
} <= set(calculate_overrides())
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@pytest.mark.parametrize(
|
|
71
|
+
"name,arguments",
|
|
72
|
+
CALLS,
|
|
73
|
+
ids=[f"{name}({', '.join(arguments[1:])})" for name, arguments in CALLS],
|
|
74
|
+
)
|
|
75
|
+
def test_keyword_call_to_a_simulation_method_binds_to_the_override(name, arguments):
|
|
76
|
+
call = dict.fromkeys(arguments)
|
|
77
|
+
inspect.signature(getattr(Simulation, name)).bind(**call)
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
inspect.signature(getattr(Microsimulation, name)).bind(**call)
|
|
81
|
+
except TypeError as error:
|
|
82
|
+
pytest.fail(
|
|
83
|
+
f"Microsimulation.{name} rejects a call that Simulation.{name} "
|
|
84
|
+
f"takes: {error}",
|
|
85
|
+
pytrace=False,
|
|
86
|
+
)
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"""Formulas that read with ADD or DIVIDE compute in a Microsimulation.
|
|
2
|
+
|
|
3
|
+
``Population.__call__`` passes ``decode_enums=False`` to ``calculate_add`` or
|
|
4
|
+
``calculate_divide`` for every ``options=[ADD]`` or ``options=[DIVIDE]`` read
|
|
5
|
+
in a formula. ``Simulation.calculate_add`` and ``calculate_divide`` take that
|
|
6
|
+
argument, but ``Microsimulation``'s overrides did not, so in a Microsimulation
|
|
7
|
+
every such read raised ``TypeError: Microsimulation.calculate_add() got an
|
|
8
|
+
unexpected keyword argument 'decode_enums'``. A Simulation computed the same
|
|
9
|
+
reads.
|
|
10
|
+
|
|
11
|
+
In a Microsimulation those two methods return a ``MicroSeries``, and pandas
|
|
12
|
+
pairs two Series' values by index label. ``household.project`` labels each
|
|
13
|
+
member's value with its household's position, so combining a projected
|
|
14
|
+
``MicroSeries`` with another Series raises a ``ValueError`` or pairs members
|
|
15
|
+
with another household's value. A formula's read with an option therefore
|
|
16
|
+
returns a NumPy array, as in a Simulation, and one the formula can write to.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import dataclasses
|
|
20
|
+
import warnings
|
|
21
|
+
|
|
22
|
+
import numpy as np
|
|
23
|
+
import pytest
|
|
24
|
+
from microdf import MicroSeries
|
|
25
|
+
|
|
26
|
+
from policyengine_core.enums import EnumArray
|
|
27
|
+
from policyengine_core.model_api import ADD, DIVIDE, MONTH
|
|
28
|
+
from tests.fixtures.microsimulation_option_reads import (
|
|
29
|
+
DATASET_YEAR,
|
|
30
|
+
READERS,
|
|
31
|
+
Inputs,
|
|
32
|
+
Tenure,
|
|
33
|
+
expected,
|
|
34
|
+
run,
|
|
35
|
+
simulations,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
EXAMPLE = Inputs(
|
|
39
|
+
household_of_person=(0, 0, 1),
|
|
40
|
+
household_weight=(10.0, 20.0),
|
|
41
|
+
monthly_pay=(
|
|
42
|
+
tuple(1.0 * month for month in range(1, 13)),
|
|
43
|
+
tuple(2.0 * month for month in range(1, 13)),
|
|
44
|
+
tuple(5.0 * month for month in range(1, 13)),
|
|
45
|
+
),
|
|
46
|
+
yearly_grant=(120.0, 240.0, 600.0),
|
|
47
|
+
household_monthly_fee=((5.0,) * 12, (0.0,) * 12),
|
|
48
|
+
household_yearly_grant=(12.0, 36.0),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
EXPECTED = {
|
|
52
|
+
"pay_added": [78.0, 156.0, 390.0],
|
|
53
|
+
"take_home_added": [58.5, 117.0, 292.5],
|
|
54
|
+
"grant_divided": [10.0, 20.0, 50.0],
|
|
55
|
+
"fee_added": [60.0, 0.0],
|
|
56
|
+
"pays_fee": [True, False],
|
|
57
|
+
"allowance_divided": [2.0, 6.0],
|
|
58
|
+
"members_pay_added": [234.0, 390.0],
|
|
59
|
+
"members_grant_divided": [30.0, 50.0],
|
|
60
|
+
"fee_and_pay_added": [294.0, 390.0],
|
|
61
|
+
"fee_or_all_paid": [True, True],
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def period_for(reader) -> str:
|
|
66
|
+
return "2022-06" if reader.definition_period == MONTH else DATASET_YEAR
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_numpy_reference_gives_the_hand_computed_values():
|
|
70
|
+
for reader in READERS:
|
|
71
|
+
np.testing.assert_array_equal(
|
|
72
|
+
expected(EXAMPLE, reader.__name__), EXPECTED[reader.__name__]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@pytest.mark.parametrize("reader", READERS, ids=lambda reader: reader.__name__)
|
|
77
|
+
def test_formula_reading_with_an_option_computes_in_a_microsimulation(reader):
|
|
78
|
+
simulation, microsimulation = simulations(EXAMPLE)
|
|
79
|
+
name, period = reader.__name__, period_for(reader)
|
|
80
|
+
|
|
81
|
+
result = microsimulation.calculate(name, period, use_weights=False)
|
|
82
|
+
|
|
83
|
+
np.testing.assert_array_equal(result, EXPECTED[name])
|
|
84
|
+
np.testing.assert_array_equal(result, simulation.calculate(name, period))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_projected_read_pairs_each_member_with_its_own_household():
|
|
88
|
+
# Two one-person households, with household 1's member listed first. A
|
|
89
|
+
# projected MicroSeries would pair each person with the other household's
|
|
90
|
+
# fee and return [True, False] without an error.
|
|
91
|
+
inputs = Inputs(
|
|
92
|
+
household_of_person=(1, 0),
|
|
93
|
+
household_weight=(10.0, 20.0),
|
|
94
|
+
monthly_pay=((0.0,) * 12, (0.0,) * 12),
|
|
95
|
+
yearly_grant=(0.0, 0.0),
|
|
96
|
+
household_monthly_fee=((0.0,) * 12, (5.0,) * 12),
|
|
97
|
+
household_yearly_grant=(0.0, 0.0),
|
|
98
|
+
)
|
|
99
|
+
simulation, microsimulation = simulations(inputs)
|
|
100
|
+
|
|
101
|
+
result = microsimulation.calculate(
|
|
102
|
+
"fee_or_all_paid", DATASET_YEAR, use_weights=False
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
np.testing.assert_array_equal(expected(inputs, "fee_or_all_paid"), [False, True])
|
|
106
|
+
np.testing.assert_array_equal(result, [False, True])
|
|
107
|
+
np.testing.assert_array_equal(
|
|
108
|
+
simulation.calculate("fee_or_all_paid", DATASET_YEAR), [False, True]
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def test_weighted_result_of_a_formula_reading_with_add_carries_its_weights():
|
|
113
|
+
_, microsimulation = simulations(EXAMPLE)
|
|
114
|
+
|
|
115
|
+
result = microsimulation.calculate("pays_fee", DATASET_YEAR)
|
|
116
|
+
|
|
117
|
+
assert isinstance(result, MicroSeries)
|
|
118
|
+
np.testing.assert_array_equal(result, [True, False])
|
|
119
|
+
np.testing.assert_array_equal(result.weights, [10.0, 20.0])
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@pytest.mark.parametrize(
|
|
123
|
+
"call",
|
|
124
|
+
[
|
|
125
|
+
("population", "person", "monthly_pay", DATASET_YEAR, ADD),
|
|
126
|
+
("population", "person", "monthly_take_home", DATASET_YEAR, ADD),
|
|
127
|
+
("population", "person", "yearly_grant", "2022-06", DIVIDE),
|
|
128
|
+
("population", "household", "household_monthly_fee", DATASET_YEAR, ADD),
|
|
129
|
+
("population", "household", "household_yearly_allowance", "2022-06", DIVIDE),
|
|
130
|
+
("population", "household", "monthly_pay", DATASET_YEAR, ADD),
|
|
131
|
+
("population", "household", "yearly_grant", "2022-06", DIVIDE),
|
|
132
|
+
],
|
|
133
|
+
ids=lambda call: f"{call[1]}-{call[2]}-{call[4]}",
|
|
134
|
+
)
|
|
135
|
+
def test_population_read_with_an_option_matches_a_simulation(call):
|
|
136
|
+
simulation, microsimulation = simulations(EXAMPLE)
|
|
137
|
+
_, entity_key, variable, period, option = call
|
|
138
|
+
|
|
139
|
+
result = microsimulation.populations[entity_key](variable, period, options=[option])
|
|
140
|
+
|
|
141
|
+
# A NumPy array, as in a Simulation: a MicroSeries pairs values by label.
|
|
142
|
+
assert type(result) is np.ndarray
|
|
143
|
+
# Formulas may write to what they read.
|
|
144
|
+
assert result.flags.writeable
|
|
145
|
+
assert result.tolist() == run(simulation, call)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@pytest.mark.parametrize(
|
|
149
|
+
"entity_key,variable,period,option",
|
|
150
|
+
[
|
|
151
|
+
("person", "monthly_pay", DATASET_YEAR, ADD),
|
|
152
|
+
("person", "yearly_grant", "2022-06", DIVIDE),
|
|
153
|
+
("household", "household_monthly_fee", DATASET_YEAR, ADD),
|
|
154
|
+
("household", "household_yearly_allowance", "2022-06", DIVIDE),
|
|
155
|
+
],
|
|
156
|
+
)
|
|
157
|
+
def test_population_read_with_an_option_gives_no_microseries_warning(
|
|
158
|
+
entity_key, variable, period, option
|
|
159
|
+
):
|
|
160
|
+
# microdf warns when a caller takes a MicroSeries' values through
|
|
161
|
+
# ``to_numpy`` or ``values``, because the result carries no weights. The
|
|
162
|
+
# formula never asked for weights, so its read gives no such warning.
|
|
163
|
+
_, microsimulation = simulations(EXAMPLE)
|
|
164
|
+
|
|
165
|
+
with warnings.catch_warnings(record=True) as caught:
|
|
166
|
+
warnings.simplefilter("always")
|
|
167
|
+
microsimulation.populations[entity_key](variable, period, options=[option])
|
|
168
|
+
|
|
169
|
+
assert [
|
|
170
|
+
str(warning.message)
|
|
171
|
+
for warning in caught
|
|
172
|
+
if "MicroSeries" in str(warning.message)
|
|
173
|
+
] == []
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@pytest.mark.parametrize("decode_enums", [False, True])
|
|
177
|
+
@pytest.mark.parametrize(
|
|
178
|
+
"method,variable,period",
|
|
179
|
+
[
|
|
180
|
+
("calculate_add", "monthly_pay", DATASET_YEAR),
|
|
181
|
+
("calculate_divide", "yearly_grant", "2022-06"),
|
|
182
|
+
],
|
|
183
|
+
)
|
|
184
|
+
def test_microsimulation_add_and_divide_take_decode_enums(
|
|
185
|
+
method, variable, period, decode_enums
|
|
186
|
+
):
|
|
187
|
+
_, microsimulation = simulations(EXAMPLE)
|
|
188
|
+
calculate = getattr(microsimulation, method)
|
|
189
|
+
|
|
190
|
+
unweighted_result = calculate(
|
|
191
|
+
variable, period, use_weights=False, decode_enums=decode_enums
|
|
192
|
+
)
|
|
193
|
+
weighted_result = calculate(variable, period, decode_enums=decode_enums)
|
|
194
|
+
|
|
195
|
+
np.testing.assert_array_equal(
|
|
196
|
+
unweighted_result, calculate(variable, period, use_weights=False)
|
|
197
|
+
)
|
|
198
|
+
np.testing.assert_array_equal(weighted_result, unweighted_result)
|
|
199
|
+
np.testing.assert_array_equal(
|
|
200
|
+
weighted_result.weights, microsimulation.get_weights(variable, period)
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def test_enum_read_with_divide_over_a_year_gives_member_names_in_a_microsimulation():
|
|
205
|
+
# This records a difference that remains. Over a year,
|
|
206
|
+
# Simulation.calculate_divide reads the variable with self.calculate,
|
|
207
|
+
# which in a Microsimulation decodes enums by default. So a
|
|
208
|
+
# Microsimulation returns member names where a Simulation returns an
|
|
209
|
+
# EnumArray, and comparing the names with a member gives False for
|
|
210
|
+
# everyone. No policyengine-us formula reads an Enum with ADD or DIVIDE.
|
|
211
|
+
inputs = dataclasses.replace(EXAMPLE, yearly_tenure=("OWNER", "RENTER", "OWNER"))
|
|
212
|
+
simulation_read, microsimulation_read = (
|
|
213
|
+
each.populations["person"]("yearly_tenure", DATASET_YEAR, options=[DIVIDE])
|
|
214
|
+
for each in simulations(inputs)
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
assert isinstance(simulation_read, EnumArray)
|
|
218
|
+
assert simulation_read.decode_to_str().tolist() == ["OWNER", "RENTER", "OWNER"]
|
|
219
|
+
assert (simulation_read == Tenure.OWNER).tolist() == [True, False, True]
|
|
220
|
+
assert microsimulation_read.tolist() == ["OWNER", "RENTER", "OWNER"]
|
|
221
|
+
assert (microsimulation_read == Tenure.OWNER).tolist() == [False, False, False]
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""Property: a Microsimulation's unweighted ADD and DIVIDE reads equal a Simulation's.
|
|
2
|
+
|
|
3
|
+
For any small dataset of households, people listed in any order, weights and
|
|
4
|
+
monthly and yearly inputs, and any sequence of reads, a Microsimulation
|
|
5
|
+
returns the same unweighted values as a Simulation loaded from the same data,
|
|
6
|
+
or raises the same kind of error. The reads are:
|
|
7
|
+
|
|
8
|
+
- formula results: each formula reads with ``options=[ADD]`` or
|
|
9
|
+
``options=[DIVIDE]``, and one projects such a read to members;
|
|
10
|
+
- the population calls formulas make;
|
|
11
|
+
- ``calculate_add`` and ``calculate_divide``, with either value of
|
|
12
|
+
``decode_enums``;
|
|
13
|
+
- plain reads at months, years and longer periods.
|
|
14
|
+
|
|
15
|
+
Population calls and the two methods read each variable over periods its
|
|
16
|
+
option accepts. Since the Simulation ignores weights, weights never change an
|
|
17
|
+
unweighted value.
|
|
18
|
+
|
|
19
|
+
The population calls return writable NumPy arrays in both classes. Formula
|
|
20
|
+
results also equal the same arithmetic done in NumPy, so the two simulations
|
|
21
|
+
cannot agree on a wrong value.
|
|
22
|
+
|
|
23
|
+
Enum variables are left out:
|
|
24
|
+
``test_enum_read_with_divide_over_a_year_gives_member_names_in_a_microsimulation``
|
|
25
|
+
records how their reads differ.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
import numpy as np
|
|
29
|
+
import pytest
|
|
30
|
+
|
|
31
|
+
from policyengine_core.model_api import ADD, DIVIDE, MONTH, YEAR
|
|
32
|
+
from tests.fixtures.microsimulation_option_reads import (
|
|
33
|
+
DATASET_YEAR,
|
|
34
|
+
MONTHS,
|
|
35
|
+
READERS,
|
|
36
|
+
SOURCES,
|
|
37
|
+
Inputs,
|
|
38
|
+
expected,
|
|
39
|
+
run,
|
|
40
|
+
simulations,
|
|
41
|
+
unweighted,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
hypothesis = pytest.importorskip("hypothesis")
|
|
45
|
+
st = hypothesis.strategies
|
|
46
|
+
|
|
47
|
+
# Whole monthly amounts, and yearly amounts in multiples of 12, keep every sum
|
|
48
|
+
# and monthly share exact in float32, so a mismatch is never rounding.
|
|
49
|
+
AMOUNTS = st.integers(-10_000, 10_000).map(float)
|
|
50
|
+
YEARLY_AMOUNTS = st.integers(-10_000, 10_000).map(lambda share: 12.0 * share)
|
|
51
|
+
WEIGHTS = st.floats(min_value=0, max_value=1e6, allow_nan=False)
|
|
52
|
+
PERIODS = ["2022", "2022-01", "2022-06", "2022-12", "2023", "month:2022-01:3"]
|
|
53
|
+
VARIABLES = SOURCES + READERS
|
|
54
|
+
|
|
55
|
+
# The periods each option reads a variable over, by the variable's definition
|
|
56
|
+
# period. Over any other period the read raises in both classes.
|
|
57
|
+
OPTION_PERIODS = {
|
|
58
|
+
(ADD, MONTH): ["2022", "2022-01", "2022-06", "2023", "month:2022-01:3"],
|
|
59
|
+
(ADD, YEAR): ["2022", "2023"],
|
|
60
|
+
(DIVIDE, YEAR): ["2022", "2022-01", "2022-06", "2022-12", "2023"],
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def option_reads(variable) -> list:
|
|
65
|
+
"""Each option and period that reads ``variable`` without an error."""
|
|
66
|
+
return [
|
|
67
|
+
(option, period)
|
|
68
|
+
for (option, definition_period), periods in OPTION_PERIODS.items()
|
|
69
|
+
if definition_period == variable.definition_period
|
|
70
|
+
for period in periods
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def readable(entity_key: str, variable) -> bool:
|
|
75
|
+
# A household's population sums its members' person variables.
|
|
76
|
+
return variable.entity.key == entity_key or (
|
|
77
|
+
entity_key == "household" and variable.entity.is_person
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
POPULATION_CALLS = [
|
|
82
|
+
("population", entity_key, variable.__name__, period, option)
|
|
83
|
+
for entity_key in ["person", "household"]
|
|
84
|
+
for variable in VARIABLES
|
|
85
|
+
if readable(entity_key, variable)
|
|
86
|
+
for option, period in option_reads(variable)
|
|
87
|
+
]
|
|
88
|
+
METHOD_CALLS = [
|
|
89
|
+
({ADD: "add", DIVIDE: "divide"}[option], variable.__name__, period, decode)
|
|
90
|
+
for variable in VARIABLES
|
|
91
|
+
for option, period in option_reads(variable)
|
|
92
|
+
for decode in [False, True]
|
|
93
|
+
]
|
|
94
|
+
REQUESTS = st.one_of(
|
|
95
|
+
st.tuples(
|
|
96
|
+
st.just("calculate"),
|
|
97
|
+
st.sampled_from(sorted(variable.__name__ for variable in VARIABLES)),
|
|
98
|
+
st.sampled_from(PERIODS),
|
|
99
|
+
),
|
|
100
|
+
st.sampled_from(POPULATION_CALLS),
|
|
101
|
+
st.sampled_from(METHOD_CALLS),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@st.composite
|
|
106
|
+
def inputs(draw):
|
|
107
|
+
sizes = draw(st.lists(st.integers(1, 3), min_size=1, max_size=4))
|
|
108
|
+
households = len(sizes)
|
|
109
|
+
# The data can list a household's members anywhere.
|
|
110
|
+
household_of_person = draw(
|
|
111
|
+
st.permutations(
|
|
112
|
+
[household for household, size in enumerate(sizes) for _ in range(size)]
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
people = len(household_of_person)
|
|
116
|
+
|
|
117
|
+
def values(count, amounts=AMOUNTS):
|
|
118
|
+
return tuple(draw(st.lists(amounts, min_size=count, max_size=count)))
|
|
119
|
+
|
|
120
|
+
return Inputs(
|
|
121
|
+
household_of_person=tuple(household_of_person),
|
|
122
|
+
household_weight=tuple(
|
|
123
|
+
draw(st.lists(WEIGHTS, min_size=households, max_size=households))
|
|
124
|
+
),
|
|
125
|
+
monthly_pay=tuple(values(12) for _ in range(people)),
|
|
126
|
+
yearly_grant=values(people, YEARLY_AMOUNTS),
|
|
127
|
+
household_monthly_fee=tuple(values(12) for _ in range(households)),
|
|
128
|
+
household_yearly_grant=values(households, YEARLY_AMOUNTS),
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def outcome_kind(outcome) -> str:
|
|
133
|
+
"""Whether a read raised, returned only zeros, or returned other values."""
|
|
134
|
+
if isinstance(outcome, str):
|
|
135
|
+
return "an error"
|
|
136
|
+
return "values" if np.any(np.asarray(outcome, dtype=float)) else "zeros"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@hypothesis.settings(max_examples=200, deadline=None)
|
|
140
|
+
@hypothesis.given(inputs(), st.lists(REQUESTS, min_size=1, max_size=6))
|
|
141
|
+
def test_unweighted_microsimulation_reads_equal_simulation_reads(data, requests):
|
|
142
|
+
simulation, microsimulation = simulations(data)
|
|
143
|
+
for request in requests:
|
|
144
|
+
result = run(microsimulation, request)
|
|
145
|
+
hypothesis.event(f"{request[0]} read gives {outcome_kind(result)}")
|
|
146
|
+
assert result == run(simulation, request), request
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@hypothesis.settings(max_examples=50, deadline=None)
|
|
150
|
+
@hypothesis.given(inputs(), st.sampled_from(POPULATION_CALLS))
|
|
151
|
+
def test_population_reads_with_an_option_return_numpy_arrays(data, call):
|
|
152
|
+
# pandas pairs two Series' values by index label, and a projected Series
|
|
153
|
+
# carries each member's group position, so formulas get positional arrays.
|
|
154
|
+
# Formulas may also write to what they read.
|
|
155
|
+
_, entity_key, variable, period, option = call
|
|
156
|
+
for simulation in simulations(data):
|
|
157
|
+
read = simulation.populations[entity_key](variable, period, options=[option])
|
|
158
|
+
assert type(read) is np.ndarray, (type(simulation).__name__, call)
|
|
159
|
+
assert read.flags.writeable, (type(simulation).__name__, call)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@pytest.mark.parametrize("reader", READERS, ids=lambda reader: reader.__name__)
|
|
163
|
+
@hypothesis.settings(max_examples=25, deadline=None)
|
|
164
|
+
@hypothesis.given(inputs(), st.sampled_from(MONTHS))
|
|
165
|
+
def test_formula_reads_with_an_option_equal_numpy_arithmetic(reader, data, month):
|
|
166
|
+
period = month if reader.definition_period == MONTH else DATASET_YEAR
|
|
167
|
+
reference = expected(data, reader.__name__)
|
|
168
|
+
for simulation in simulations(data):
|
|
169
|
+
result = simulation.calculate(reader.__name__, period, **unweighted(simulation))
|
|
170
|
+
np.testing.assert_array_equal(
|
|
171
|
+
np.asarray(result, dtype=float), np.asarray(reference, dtype=float)
|
|
172
|
+
)
|
{policyengine_core-3.36.0 → policyengine_core-3.36.2}/tests/core/test_reform_baseline_system.py
RENAMED
|
@@ -193,7 +193,14 @@ def test_the_baseline_drops_a_holder_built_for_another_entity():
|
|
|
193
193
|
"households": {"h": {"parents": ["a", "b"]}},
|
|
194
194
|
}
|
|
195
195
|
reform = Simulation(situation=situation, reform=move_salary_to_households)
|
|
196
|
-
|
|
196
|
+
# Create the reform's household holder before cloning the baseline branch so
|
|
197
|
+
# ``_bind_to_tax_benefit_system`` must drop the cross-entity holder.
|
|
198
|
+
reform.calculate("salary", PERIOD)
|
|
199
|
+
del reform.branches["baseline"]
|
|
200
|
+
baseline = reform.get_branch("baseline")
|
|
201
|
+
baseline.tax_benefit_system = reform.default_tax_benefit_system_instance
|
|
202
|
+
baseline._bind_to_tax_benefit_system()
|
|
203
|
+
baseline.input_variables = list(baseline.input_variables)
|
|
197
204
|
|
|
198
205
|
assert "salary" in reform.household._holders
|
|
199
206
|
assert "salary" not in baseline.household._holders
|