Skip to content

Commit

Permalink
Merge pull request #933 from PolicyEngine/chore/test_private_school_vat
Browse files Browse the repository at this point in the history
Add tests to `private_school_vat` and `attends_private_school`
  • Loading branch information
anth-volk authored Aug 28, 2024
2 parents 558c436 + 5b3ca2d commit 8043884
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- bump: patch
changes:
added:
- Test suite for private_school_vat
- Test suite for attends_private_school
removed:
- Unnecessary print statement in winter_fuel_allowance
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
- name: Attends private school returns True when attendance rate is 100%
period: 2024
input:
gov.simulation.private_school_vat.private_school_attendance_rate.100: 1
gov.simulation.private_school_vat.private_school_attendance_rate.95: 1
people:
adult:
age: 25
child:
age: 10
households:
household:
household_weight: 0.001
household_market_income: 1_000_000_000
household_benefits: 0
members: [
adult,
child
]
output:
attends_private_school: [False, True]

- name: Attends private school returns False when attendance rate is 0%
period: 2024
input:
gov.simulation.private_school_vat.private_school_attendance_rate.100: 0
gov.simulation.private_school_vat.private_school_attendance_rate.95: 0
people:
adult:
age: 25
child:
age: 10
households:
household:
household_weight: 0.001
household_market_income: 1_000_000_000
household_benefits: 0
members: [
adult,
child
]
output:
attends_private_school: [False, False]

- name: Attends private school successfully returns False when household weights are 0
period: 2024
input:
people:
adult:
age: 25
child:
age: 10
households:
household:
household_weight: 0
household_market_income: 1_000_000_000
household_benefits: 0
members: [
adult,
child
]
output:
attends_private_school: [False, False]
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
- name: Returns 0 when no children
period: 2024
input:
# Set private school VAT rate to 25% to ensure correct testing
gov.contrib.labour.private_school_vat: 0.25
people:
adult:
age: 25
households:
household:
members: [
adult,
]
output:
private_school_vat: 0

- name: Returns correctly with one child
period: 2024
input:
# Set private school VAT rate to 25% to ensure correct testing
gov.contrib.labour.private_school_vat: 0.25
# Override other default settings for easier testing
gov.simulation.private_school_vat.private_school_vat_basis: 1
gov.simulation.private_school_vat.private_school_fees: 10_000
people:
adult:
age: 25
child:
age: 10
attends_private_school: True
households:
household:
members: [
adult,
child
]
output:
private_school_vat: 2_500

- name: Returns correct value with 2+ children
period: 2024
input:
# Set private school VAT rate to 25% to ensure correct testing
gov.contrib.labour.private_school_vat: 0.25
# Override other default settings for easier testing
gov.simulation.private_school_vat.private_school_vat_basis: 1
gov.simulation.private_school_vat.private_school_fees: 10_000
people:
adult:
age: 25
child1:
age: 10
attends_private_school: True
child2:
age: 12
attends_private_school: True
households:
household:
members: [
adult,
child1,
child2
]
output:
private_school_vat: 5_000
1 change: 0 additions & 1 deletion policyengine_uk/variables/gov/dwp/WFA.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def formula(household, period, parameters):
> 0
)
meets_mtb_requirement = on_mtb | ~wfp.eligibility.require_benefits
print(wfp.eligibility.require_benefits)
meets_spa_requirement = (
household.any(is_SP_age)
| ~wfp.eligibility.state_pension_age_requirement
Expand Down

0 comments on commit 8043884

Please sign in to comment.