Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1f0cd1b
Make head_is_dependent_elsewhere consumers independent of the head label
MaxGhenis Oct 8, 2026
3ecc675
Keep tax units without a filer eligible where only claimed filers are…
MaxGhenis Oct 9, 2026
8da8312
Address review: Hawaii worksheet earnings, NM same-filer age, childle…
MaxGhenis Oct 9, 2026
e838623
Allow a cent of rounding in the Hawaii self-employed joint pair
MaxGhenis Oct 9, 2026
41fb4a5
Address review round 2: worksheet earnings, minors' own status, input…
MaxGhenis Oct 9, 2026
527d47f
Merge remote-tracking branch 'upstream/main' into head-dependent-else…
MaxGhenis Oct 9, 2026
436805e
Merge the Hawaii deductions references after syncing main
MaxGhenis Oct 9, 2026
23c6229
Apply the federal rules for a filer who can be claimed as a dependent
MaxGhenis Oct 9, 2026
4b0709e
Apply New Mexico's rules for a filer who can be claimed as a dependent
MaxGhenis Oct 9, 2026
4597c55
Address the federal claimable-filer review
MaxGhenis Oct 10, 2026
0de9a0e
Address the New Mexico claimable-filer review
MaxGhenis Oct 10, 2026
be8dc32
Merge commit '4597c55a86' into claimable-filer-nm
MaxGhenis Oct 10, 2026
631623d
Keep the New Mexico EITC child route for minors and add older qualify…
MaxGhenis Oct 10, 2026
e4b8f36
Separate dependency facts and fix Hawaii qualified-person counts
MaxGhenis Oct 10, 2026
c7f969f
Clarify claimability outside the current tax unit
MaxGhenis Oct 10, 2026
4c8ed81
Merge commit 'c7f969f872' into claimable-filer-federal
MaxGhenis Oct 10, 2026
3f88702
Read the split dependency inputs from #10024
MaxGhenis Oct 10, 2026
a112648
Merge commit '3f8870261c' into claimable-filer-nm
MaxGhenis Oct 10, 2026
167e2ed
Read the split dependency inputs from #10024 in New Mexico
MaxGhenis Oct 10, 2026
b2771d2
Follow the corrected exemption count in three Hawaii credits
MaxGhenis Oct 10, 2026
648e4d7
Merge commit 'b2771d2f15' into claimable-filer-nm
MaxGhenis Oct 10, 2026
163fcd4
Address the second federal claimable-filer review
MaxGhenis Oct 10, 2026
20196b7
Merge commit '163fcd4cfa98345d5ec0c358d2d35c8516789334' into claimabl…
MaxGhenis Oct 10, 2026
99ff9fd
Do not count a filer under 18 as the New Mexico EITC's child
MaxGhenis Oct 10, 2026
3d0864f
Address the third federal claimable-filer review
MaxGhenis Oct 10, 2026
5952be3
Merge commit '3d0864f778' into claimable-filer-nm
MaxGhenis Oct 10, 2026
0ef979a
Open New Mexico's EITC child route only for a qualifying child
MaxGhenis Oct 10, 2026
35a2cbc
Give the spouse without an SSN a card type in the recovery rebate test
MaxGhenis Oct 10, 2026
81f0f97
Merge commit '35a2cbcbb971f6b43d35db009d9bda41b76386a5' into claimabl…
MaxGhenis Oct 10, 2026
147205c
Merge main into claimable-filer-nm after #10087
MaxGhenis Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/claimable-filer-nm.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Apply New Mexico's rules for a filer who can be claimed as a dependent: no child income tax credit when every filer can be claimed (NMSA 7-2-18.34), no childless EITC, child care credit child or certain-dependents deduction on a return with a claimable filer, and the medical care credit, property tax rebate and centenarian exemption only for a filer who meets the age test and cannot be claimed; the medical expense credit and exemption and the childless EITC now test filers' ages, not a dependent's, and the EITC's child route also counts older qualifying children under IRC 32(c)(3) (a dependent aged 18, a student under 24 or a permanently disabled child).
95 changes: 95 additions & 0 deletions policyengine_us/tests/core/test_claimable_filer_nm_invariants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""New Mexico rules for a filer who can be claimed as a dependent.

Several credits and exemptions bar "a dependent of another individual", and
dependent-based amounts need dependents that a return with a claimable filer
cannot have (IRC 152(b)(1)).

For couples with either, both or neither spouse claimed:

1. Swap invariance: each output is the same under either head/spouse
labelling (Hypothesis batches, the seeded population and the crafted
centenarian cases).
2. Monotonicity: marking another filer as claimed never raises an output
(seeded population and crafted cases only).

The crafted cases add spouses aged 100 or older, whom the generated population
(ages 18 to 90) never has.
"""

import pytest
from hypothesis import HealthCheck, given, settings
from hypothesis import strategies as st

from policyengine_us.tests.core.test_claimable_filer_federal_invariants import (
check_monotone,
check_swap,
)
from policyengine_us.tests.core.test_dependent_elsewhere_head_spouse_swap_invariance import (
CLAIM_PATTERNS,
_crafted_cases,
_seeded_couples,
adults,
dependents,
)

STATES = ["NM"]
YEARS = [2023, 2025, 2026]
OUTPUTS = [
"nm_ctc",
"nm_medical_expense_credit",
"nm_medical_expense_exemption",
"nm_eitc",
"nm_deduction_for_certain_dependents",
"nm_property_tax_rebate",
"nm_cdcc_max_amount",
"nm_hundred_year_exemption",
]


def _centenarian_cases():
# One or both spouses aged 100 or older, with income to exempt.
centenarian = {"age": 101, "taxable_pension_income": 20_000.0}
older = {"age": 103, "taxable_interest_income": 5_000.0}
younger = {"age": 70, "social_security_retirement": 12_000.0}
return [
{
"state": "NM",
"adults": couple,
"dependents": [],
"claimed": claimed,
}
for couple in ([centenarian, younger], [centenarian, older])
for claimed in [(True, False), (False, True), (True, True)]
]


@st.composite
def couples(draw):
return {
"state": draw(st.sampled_from(STATES)),
"adults": [draw(adults()), draw(adults())],
"dependents": draw(st.lists(dependents(), max_size=2)),
"claimed": draw(st.sampled_from(CLAIM_PATTERNS)),
}


@settings(
max_examples=2,
deadline=None,
derandomize=True,
suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large],
)
@given(st.sampled_from(YEARS), st.lists(couples(), min_size=6, max_size=12))
def test_nm_claimable_filer_rules_are_label_free(year, units):
check_swap(units, year, OUTPUTS)


@pytest.mark.parametrize("year", YEARS)
def test_nm_claimable_filer_rules_seeded_population(year):
units = (
_seeded_couples(STATES, per_state=3)
+ _crafted_cases(STATES)
+ _centenarian_cases()
)
check_swap(units, year, OUTPUTS)
check_monotone(units, year, OUTPUTS)
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,140 @@
is_tax_unit_dependent: true
output:
nm_cdcc_eligible_child: true

- name: 2025 joint return with one claimable spouse has no eligible child (the claimable spouse is the head)
period: 2025
input:
people:
person_a:
age: 30
claimed_as_dependent_on_another_return: true
is_tax_unit_head: true
is_tax_unit_spouse: false
person_b:
age: 30
is_tax_unit_head: false
is_tax_unit_spouse: true
child:
age: 5
tax_units:
tax_unit:
members: [person_a, person_b, child]
filing_status: JOINT
households:
household:
members: [person_a, person_b, child]
state_code: NM
output:
# NMSA 7-2-18.1 counts IRC 152 dependents; IRC 152(b)(1) leaves such a
# return none.
nm_cdcc_eligible_child: [false, false, false]

- name: 2025 joint return with one claimable spouse has no eligible child (the claimable spouse is the spouse)
period: 2025
input:
people:
person_b:
age: 30
is_tax_unit_head: true
is_tax_unit_spouse: false
person_a:
age: 30
claimed_as_dependent_on_another_return: true
is_tax_unit_head: false
is_tax_unit_spouse: true
child:
age: 5
tax_units:
tax_unit:
members: [person_b, person_a, child]
filing_status: JOINT
households:
household:
members: [person_b, person_a, child]
state_code: NM
output:
# NMSA 7-2-18.1 counts IRC 152 dependents; IRC 152(b)(1) leaves such a
# return none.
nm_cdcc_eligible_child: [false, false, false]

- name: 2025 joint return with neither spouse claimable has an eligible child
period: 2025
input:
people:
person_a:
age: 30
person_b:
age: 30
child:
age: 5
tax_units:
tax_unit:
members: [person_a, person_b, child]
filing_status: JOINT
households:
household:
members: [person_a, person_b, child]
state_code: NM
output:
nm_cdcc_eligible_child: [false, false, true]

# Publication 501, Dependent Taxpayer Test: a filer whose would-be claimant is not
# required to file and files no return or only for a refund can claim dependents.
- name: 2025 joint return whose claimable spouse is within the filing exception has an eligible child (the claimable spouse is the head)
period: 2025
input:
people:
person_a:
age: 30
claimable_as_dependent_on_another_return: true
dependent_claimant_filing_exception: true
is_tax_unit_head: true
is_tax_unit_spouse: false
person_b:
age: 30
is_tax_unit_head: false
is_tax_unit_spouse: true
child:
age: 5
is_tax_unit_head: false
is_tax_unit_spouse: false
tax_units:
tax_unit:
members: [person_a, person_b, child]
filing_status: JOINT
households:
household:
members: [person_a, person_b, child]
state_code: NM
output:
nm_cdcc_eligible_child: [false, false, true]

- name: 2025 joint return whose claimable spouse is within the filing exception has an eligible child (the claimable spouse is the spouse)
period: 2025
input:
people:
person_b:
age: 30
is_tax_unit_head: true
is_tax_unit_spouse: false
person_a:
age: 30
claimable_as_dependent_on_another_return: true
dependent_claimant_filing_exception: true
is_tax_unit_head: false
is_tax_unit_spouse: true
child:
age: 5
is_tax_unit_head: false
is_tax_unit_spouse: false
tax_units:
tax_unit:
members: [person_b, person_a, child]
filing_status: JOINT
households:
household:
members: [person_b, person_a, child]
state_code: NM
output:
nm_cdcc_eligible_child: [false, false, true]
Loading
Loading