From b271c896f363623834b31b81219c95400d6400d2 Mon Sep 17 00:00:00 2001 From: Hamish Fraser Date: Sun, 3 Dec 2023 11:30:03 +1300 Subject: [PATCH] Resolves multiple warnings when running test suites, apparently required values not supplied result in warnings --- .../2018/_benefit_me.yaml | 6 ++++ .../2018/accommodation_supplement.yaml | 8 +++-- .../2018/exclusion.yaml | 8 +++++ .../tests/student_allowance/basic_grant.yaml | 35 ++++++++++--------- .../variables/demographics/ages.py | 2 ++ 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml index d1080458..cd42e801 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml @@ -24,6 +24,8 @@ 2022-W49: rent accommodation_supplement__area_of_residence: 2022-W49: area_2 + student_allowance__person_has_spouse: + 2022-12: false output: jobseeker_support__benefit: 2022-W49: 440.96 @@ -59,6 +61,8 @@ 2022-W49: rent accommodation_supplement__area_of_residence: 2022-W49: area_2 + student_allowance__person_has_spouse: + 2022-12: false Anahera: family_tax_credit__dependent_child: 2022: .5 @@ -89,6 +93,8 @@ week:2022-W01:52: area_2 accommodation_supplement__cash_assets: 2022-W49: 800 + student_allowance__person_has_spouse: + 2022-12: false output: jobseeker_support__benefit: 2022-W49: 0 diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml index a6ba8f27..5d083b69 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml @@ -21,8 +21,8 @@ 2024-W01: [8100, 8100, 8100, 8100, 8101, 8100] age: day:2022-01-03:7: [24, 24, 24, 24, 24, 24] - day:2022-01-11:7: [24, 24, 24, 24, 24, 24] - day:2023-01-01:7: [24, 24, 24, 24, 24, 24] + day:2022-01-10:7: [24, 24, 24, 24, 24, 24] + day:2023-01-02:7: [24, 24, 24, 24, 24, 24] day:2024-01-01:7: [24, 24, 24, 24, 24, 24] jobseeker_support__receiving: 2022-W01: [true, true, true, true, true, true] @@ -39,6 +39,10 @@ 2022-W02: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] 2023-W01: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] 2024-W01: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] + basic_grant__entitled: + 2022-01: [false, false, false, false, false, false] + 2023-01: [false, false, false, false, false, false] + 2024-01: [false, false, false, false, false, false] output: accommodation_supplement: 2022-W01: [0.00, 21.26, 56.26, 91.26, 0.00, 165.00] # January diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml index 0deb7e9a..41fc6ac6 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml @@ -45,6 +45,8 @@ input: basic_grant__receiving: 2022-W01: [true, true, false, false] + basic_grant__entitled: + 2022-01: [true, true, false, false] independent_circumstances_grant__receiving: 2022-W01: [true, false, true, false] output: @@ -79,6 +81,8 @@ input: basic_grant__would_be_entitled: 2022-W01: [true, true, false, false] + basic_grant__entitled: + 2022-01: [true, true, false, false] independent_circumstances_grant__would_be_entitled: 2022-W01: [true, false, true, false] output: @@ -95,6 +99,8 @@ input: accommodation_type: 2022-W01: [residential_care, under_the_moon] + basic_grant__entitled: + 2022-01: [false, false] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, false] @@ -109,6 +115,8 @@ input: accommodation_supplement__disability: 2022-W01: [true, false] + basic_grant__entitled: + 2022-01: [false, false] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, false] diff --git a/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml b/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml index 3109f7a5..058c9d9c 100644 --- a/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml +++ b/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml @@ -6,16 +6,17 @@ persons: fulltime_uni_student: age: - "2017-08-01": 21 + day:2017-08-01:31: 21 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true + student_allowance__married_or_partnered: false Parttime_student: age: - "2017-08-01": 18 + day:2017-08-01:31: 18 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -23,7 +24,7 @@ Overseas_student: age: - "2017-08-01": 27 + day:2017-08-01:31: 27 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -31,7 +32,7 @@ Refugee: age: - "2017-08-01": 25 + day:2017-08-01:31: 25 immigration__recognised_refugee: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true @@ -39,7 +40,7 @@ Not_a_student: age: - "2017-08-01": 50 + day:2017-08-01:31: 50 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: false @@ -57,7 +58,7 @@ persons: married_secondary_school_student_with_child: age: - "2017-08-01": 16 + day:2017-08-01:31: 16 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true @@ -69,7 +70,7 @@ not_married_secondary_school_student_with_child: age: - "2017-08-01": 16 + day:2017-08-01:31: 16 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true @@ -80,7 +81,7 @@ childless_married_secondary_school_student: age: - "2017-08-01": 16 + day:2017-08-01:31: 16 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true @@ -91,7 +92,7 @@ 18yo_secondary_student: age: - "2017-08-01": 18 + day:2017-08-01:31: 18 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true @@ -110,11 +111,12 @@ persons: default: age: - "2017-08-01": 22 + day:2017-08-01:31: 22 + student_allowance__married_or_partnered: false not_attending: age: - "2017-08-01": 21 + day:2017-08-01:31: 21 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -123,7 +125,7 @@ not_immigration__citizen_or_resident: age: - "2017-08-01": 21 + day:2017-08-01:31: 21 student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true @@ -140,16 +142,17 @@ persons: fulltime_uni_studdent: age: - "2017-08-01": 67 + day:2017-08-01:31: 67 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true + student_allowance__married_or_partnered: false Parttime_student: age: - "2017-08-01": 68 + day:2017-08-01:31: 68 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -157,7 +160,7 @@ Overseas_student: age: - "2017-08-01": 70 + day:2017-08-01:31: 70 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -165,7 +168,7 @@ Refugee: age: - "2017-08-01": 99 + day:2017-08-01:31: 99 immigration__recognised_refugee: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true diff --git a/openfisca_aotearoa/variables/demographics/ages.py b/openfisca_aotearoa/variables/demographics/ages.py index 1f125738..b1fc9203 100644 --- a/openfisca_aotearoa/variables/demographics/ages.py +++ b/openfisca_aotearoa/variables/demographics/ages.py @@ -8,6 +8,7 @@ # Import from openfisca-core the common python objects used to code the legislation in OpenFisca from openfisca_core.periods import DAY, ETERNITY from openfisca_core.variables import Variable +from openfisca_core.holders import set_input_dispatch_by_period # Import the entities specifically defined for this tax and benefit system from openfisca_aotearoa.entities import Family, Person @@ -70,6 +71,7 @@ class age_of_partner(Variable): definition_period = DAY unit = "years" label = "The maximum age of partner in a family" + set_input = set_input_dispatch_by_period def formula(persons, period, parameters): return persons.family.max(persons.family.members("age", period), role=Family.PARTNER)