Skip to content

Conversation

vahid-ahmadi
Copy link

@vahid-ahmadi vahid-ahmadi commented Oct 7, 2025

Fixes #337

@vahid-ahmadi vahid-ahmadi self-assigned this Oct 7, 2025
@vahid-ahmadi vahid-ahmadi added the bug Something isn't working label Oct 7, 2025
@MaxGhenis
Copy link
Contributor

Can you add a test? Ideally a test that would have failed before this pr

@vahid-ahmadi
Copy link
Author

Can you add a test? Ideally a test that would have failed before this pr

Added tests. Both tests pass locally and verify the behavioral response detection works correctly.

Test coverage:

  • test_uk_behavioral_response_calls_apply_dynamics: Verifies apply_dynamics() is called when gov.simulation.labor_supply_responses.income_elasticity is present in the reform
  • test_uk_without_behavioral_response_no_apply_dynamics: Verifies apply_dynamics() is NOT called for regular reforms without behavioral parameters

Additional changes in this PR:

  • country.py (lines 301-328): Original feature - detects behavioral response parameters and calls apply_dynamics() when present
  • country.py (lines 207-211): Bug fix - handles PosixPath in _build_modeled_policies() (was blocking COUNTRIES initialization)
  • country.py (lines 245-248): Bug fix - handles None labels in _build_parameter() (was causing US parameter validation errors)
  • country.py (lines 556-559): Temporarily commented out ca/ng/il countries in COUNTRIES dict since their packages aren't in CI dependencies
  • pyproject.toml + uv.lock: Added test dependencies (policyengine-core, policyengine-uk, policyengine-us, setuptools)

The bug fixes were necessary to get tests running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the UK lsr functionality

2 participants