-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test file, code in python file, and max credit file added Fixes #352
- Loading branch information
Showing
6 changed files
with
174 additions
and
110 deletions.
There are no files selected for viewing
110 changes: 10 additions & 100 deletions
110
.../gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/base_amount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,23 @@ | ||
description: New Brunswick provides the following Spouse or Common-law partner base amount. | ||
values: | ||
2022-01-01: x | ||
2023-01-01: 10_741 | ||
2024-01-01: 11_246 | ||
metadata: | ||
unit: currency-CAD | ||
period: year | ||
label: New Brunswick Spouse or Common-law Partner Base Amount | ||
reference: | ||
- title: Worksheet for the 2022 New Brunswick Personal Tax Credits Return | ||
href: https://www.cchwebsites.com/content/pdf/tax_forms/ca/en/td1nbws_en.pdf#page=1 | ||
- title: 2022 New Brunswick Personal Tax Credits Return | ||
href: https://www.vitalitenb.ca/sites/default/files/documents/employes/td1nb_nb_personal_tax_credits_return.pdf#page=1 | ||
- title: Worksheet for the 2023 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb-ws/td1nb-ws-23e.pdf#page=1 | ||
- title: 2023 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb-ws/td1nb-ws-23e.pdf#page=1 | ||
- title: 2024 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb/td1nb-24e.pdf#page=1 | ||
- title: Worksheet for the 2024 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb-ws/td1nb-ws-24e.pdf#page=1 | ||
|
||
- name: No spouse income | ||
period: 2023 | ||
input: | ||
people: | ||
head: | ||
spouse_income: 0 | ||
spouse: | ||
spouse_income: 0 | ||
household: | ||
members: [head, spouse] | ||
province_code: NB | ||
output: | ||
ab_spouse_and_common_law_partner_amount_credit: 9_764 | ||
|
||
- name: Spouse income of $1,000 | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
spouse_income: 1_000 | ||
output: | ||
ab_spouse_and_common_law_partner_amount_credit: 9_741 | ||
|
||
- name: Spouse income of $10,000 | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
spouse_income: 10_000 | ||
output: | ||
ab_spouse_and_common_law_partner_amount_credit: 741 | ||
|
||
- name: Capped at 0 | ||
period: 2023 | ||
input: | ||
province_code: AB | ||
spouse_income: 40_000 | ||
output: | ||
ab_spouse_and_common_law_partner_amount_credit: 0 | ||
|
||
SPOUSE_INCOME | ||
- name: One person eligible and one not | ||
period: 2023 | ||
input: | ||
people: | ||
head: | ||
is_spouse: false | ||
individual_net_income: 10_000 | ||
spouse: | ||
is_spouse: true | ||
individual_net_income: 1_000 | ||
household: | ||
members: [head, spouse] | ||
province_code: NB | ||
output: | ||
spouse_income: [0, 1_000] | ||
|
||
- name: Eligible spouse | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
is_spouse: true | ||
individual_net_income: 10_000 | ||
output: | ||
spouse_income: 10_000 | ||
|
||
- name: Ineligible spouse | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
is_spouse: false | ||
individual_net_income: 10_000 | ||
output: | ||
spouse_income: 0 | ||
|
||
|
||
from policyengine_canada.model_api import * | ||
|
||
class nb_spouse_and_common_law_partner_amount_credit(Variable): | ||
value_type = float | ||
entity = Household | ||
label = "New Brunswick spouse and common-law partner amount credit" | ||
definition_period = YEAR | ||
defined_for = ProvinceCode.NB | ||
|
||
def formula(household, period, parameters): | ||
spouse_income = add(household, period, ["spouse_income"]) | ||
base_amount = 10_741 | ||
max_credit = 9_764 | ||
result = base_amount - spouse_income | ||
return min(max_credit, max(0, result)) | ||
|
||
class spouse_income(Variable): | ||
value_type = float | ||
entity = Person | ||
label = "Spouse and commonlaw partner income" | ||
definition_period = YEAR | ||
|
||
def formula(person, period, parameters): | ||
spouse = person("is_spouse", period) | ||
income = person("individual_net_income", period) | ||
return spouse * income |
10 changes: 0 additions & 10 deletions
10
...s/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/income_cap.yaml
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...s/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_credit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
description: The New Brunswick spouse or common-law partner amount credit is calculated by taking into account the spouse's net income and comparing it to a base amount. The maximum credit is the highest amount that can be claimed as a credit. | ||
values: | ||
2022-01-01: 9_186 | ||
2023-01-01: 9_764 | ||
2024-01-01: 10_223 | ||
metadata: | ||
unit: currency-CAD | ||
period: year | ||
label: New Brunswick Spouse or Common-law Partner Max Credit | ||
reference: | ||
- title: Worksheet for the 2022 New Brunswick Personal Tax Credits Return | ||
href: https://www.cchwebsites.com/content/pdf/tax_forms/ca/en/td1nbws_en.pdf#page=1 | ||
- title: Worksheet for the 2023 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb-ws/td1nb-ws-23e.pdf#page=1 | ||
- title: Worksheet for the 2024 New Brunswick Personal Tax Credits Return | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb-ws/td1nb-ws-24e.pdf#page=1 |
31 changes: 31 additions & 0 deletions
31
...its/spouse_or_common_law_partner_amount/nb_spouse_and_common_law_partner_amount_credit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from policyengine_canada.model_api import * | ||
|
||
class nb_spouse_and_common_law_partner_amount_credit(Variable): | ||
value_type = float | ||
entity = Household | ||
label = "New Brunswick spouse and common-law partner amount credit" | ||
definition_period = YEAR | ||
defined_for = ProvinceCode.NB | ||
|
||
p = parameters(period).gov.provinces.nb.tax.income.credits.spouse_or_common_law_partner_amount | ||
base_amount = p.base_amount | ||
max_credit = p.max_credit | ||
|
||
def formula(household, period, parameters): | ||
year = period.start.year | ||
if year == 2022: | ||
base_amount = 10_105 | ||
max_credit = 9_186 | ||
elif year == 2023: | ||
base_amount = 10_741 | ||
max_credit = 9_764 | ||
elif year == 2024: | ||
base_amount = 11_246 | ||
max_credit = 10_223 | ||
else: | ||
raise ValueError(f"Year {year} not supported.") | ||
|
||
spouse_income = add(household, period, ["spouse_income"]) | ||
result = base_amount - spouse_income | ||
return min(max_credit, max(0, result)) | ||
|
78 changes: 78 additions & 0 deletions
78
...s/spouse_or_common_law_partner_amount/nb_spouse_and_common_law_partner_amount_credit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
- name: No spouse income in 2022 | ||
period: 2022 | ||
input: | ||
people: | ||
head: | ||
spouse_income: 0 | ||
spouse: | ||
spouse_income: 0 | ||
household: | ||
members: [head, spouse] | ||
province_code: NB | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 9_186 | ||
|
||
- name: Spouse income of $1,000 in 2022 | ||
period: 2022 | ||
input: | ||
province_code: NB | ||
spouse_income: 1_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 9_105 | ||
|
||
- name: Spouse income of $10,000 in 2022 | ||
period: 2022 | ||
input: | ||
province_code: NB | ||
spouse_income: 10_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 105 | ||
|
||
- name: Capped at 0 in 2022 | ||
period: 2022 | ||
input: | ||
province_code: NB | ||
spouse_income: 40_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 0 | ||
|
||
|
||
- name: No spouse income | ||
period: 2023 | ||
input: | ||
people: | ||
head: | ||
spouse_income: 0 | ||
spouse: | ||
spouse_income: 0 | ||
household: | ||
members: [head, spouse] | ||
province_code: NB | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 9_764 | ||
|
||
- name: Spouse income of $1,000 | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
spouse_income: 1_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 9_741 | ||
|
||
- name: Spouse income of $10,000 | ||
period: 2023 | ||
input: | ||
province_code: NB | ||
spouse_income: 10_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 741 | ||
|
||
- name: Capped at 0 | ||
period: 2023 | ||
input: | ||
province_code: AB | ||
spouse_income: 40_000 | ||
output: | ||
nb_spouse_and_common_law_partner_amount_credit: 0 | ||
|
||
|
39 changes: 39 additions & 0 deletions
39
...ameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
- name: One person eligible and one not | ||
period: 2022 | ||
period: 2023 | ||
period: 2024 | ||
input: | ||
people: | ||
head: | ||
is_spouse: false | ||
individual_net_income: 10_000 | ||
spouse: | ||
is_spouse: true | ||
individual_net_income: 1_000 | ||
household: | ||
members: [head, spouse] | ||
province_code: NB | ||
output: | ||
spouse_income: [0, 1_000] | ||
|
||
- name: Eligible spouse | ||
period: 2022 | ||
period: 2023 | ||
period: 2024 | ||
input: | ||
province_code: NB | ||
is_spouse: true | ||
individual_net_income: 10_000 | ||
output: | ||
spouse_income: 10_000 | ||
|
||
- name: Ineligible spouse | ||
period: 2022 | ||
period: 2023 | ||
period: 2024 | ||
input: | ||
province_code: NB | ||
is_spouse: false | ||
individual_net_income: 10_000 | ||
output: | ||
spouse_income: 0 |