Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The additional tax bracket contrib reform now applies half the joint 33% threshold to separate filers from 2026 and a $539,900 single-filer 35% threshold for 2022. Tests reject repeated or inverted mapped thresholds and NaN parameter values, including values inside lists, dictionaries and sets.
Original file line number Diff line number Diff line change
Expand Up @@ -680,16 +680,16 @@ thresholds:
2024-01-01: 243_725
2025-01-01: 250_525
# CBO forecast.
2026-01-01: 541_550
2027-01-01: 553_050
2028-01-01: 564_200
2029-01-01: 575_400
2030-01-01: 586_750
2031-01-01: 598_350
2032-01-01: 610_200
2033-01-01: 622_300
2034-01-01: 634_650
2035-01-01: 647_250
2026-01-01: 270_775
2027-01-01: 276_525
2028-01-01: 282_100
2029-01-01: 287_700
2030-01-01: 293_375
2031-01-01: 299_175
2032-01-01: 305_100
2033-01-01: 311_150
2034-01-01: 317_325
2035-01-01: 323_625
metadata:
uprating:
parameter: gov.irs.uprating
Expand Down Expand Up @@ -757,7 +757,7 @@ thresholds:
2019-01-01: 510_300
2020-01-01: 518_400
2021-01-01: 523_600
2022-01-01: 539_000
2022-01-01: 539_900
2023-01-01: 578_125
2024-01-01: 609_350
2025-01-01: 626_350
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,67 @@
income_tax_main_rates: 6_962.50
tax_on_taxable_income_at_main_rates: 19_462.50
capital_gains_tax: 12_500

- name: A separate filer's 33% bracket ends at half the joint threshold under the reform.
period: 2026
absolute_error_margin: 0.01
reforms: policyengine_us.reforms.additional_tax_bracket.additional_tax_bracket_reform.additional_tax_bracket
input:
gov.contrib.additional_tax_bracket.in_effect: true
taxable_income: 300_000
filing_status: SEPARATE
output:
# 2026 separate thresholds 12,150 / 49,300 / 99,500 / 151,625 / 270,775 /
# 305,875 at 10 / 15 / 25 / 28 / 33 / 35%:
# 1,215 + 5,572.50 + 12,550 + 14,595 + 39,319.50 + 0.35 * 29,225.
income_tax_main_rates: 83_480.75

- name: A separate filer above the 35% bracket pays 39.6% under the reform.
period: 2026
absolute_error_margin: 0.01
reforms: policyengine_us.reforms.additional_tax_bracket.additional_tax_bracket_reform.additional_tax_bracket
input:
gov.contrib.additional_tax_bracket.in_effect: true
taxable_income: 400_000
filing_status: SEPARATE
output:
# 83,480.75 on the first 300,000 (case above), plus 35% of 5,875 up to
# 305,875, plus 39.6% of the remaining 94,125.
income_tax_main_rates: 122_810.50

- name: A single filer stays in the 35% bracket through 539900 in 2022.
period: 2022
absolute_error_margin: 0.01
reforms: policyengine_us.reforms.additional_tax_bracket.additional_tax_bracket_reform.additional_tax_bracket
input:
gov.contrib.additional_tax_bracket.in_effect: true
taxable_income: 539_450
filing_status: SINGLE
output:
# IRS Rev. Proc. 2021-45, Table 3: 49,335.50 + 35% of 323,500.
income_tax_main_rates: 162_560.50

- name: A single filer pays 37% above 539900 in 2022.
period: 2022
absolute_error_margin: 0.01
reforms: policyengine_us.reforms.additional_tax_bracket.additional_tax_bracket_reform.additional_tax_bracket
input:
gov.contrib.additional_tax_bracket.in_effect: true
taxable_income: 540_000
filing_status: SINGLE
output:
# IRS Rev. Proc. 2021-45, Table 3: 162,718 + 37% of 100.
income_tax_main_rates: 162_755

- name: A separate filer pays 39.6% above the projected 2035 threshold.
period: 2035
absolute_error_margin: 0.01
reforms: policyengine_us.reforms.additional_tax_bracket.additional_tax_bracket_reform.additional_tax_bracket
input:
gov.contrib.additional_tax_bracket.in_effect: true
taxable_income: 400_000
filing_status: SEPARATE
output:
# CBO January 2025: 87,547.25 through 323,625, then 35% of 41,950
# through 365,575, plus 39.6% of the remaining 34,425.
income_tax_main_rates: 115_862.05
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,40 @@ def test_baseline_schedule_is_unchanged_in_every_year():
assert np.array_equal(below, old_below), (status, year)


def test_shipped_separate_thresholds_equal_half_joint_thresholds():
thresholds = baseline_system.parameters.get_child(f"{BRACKET}.thresholds")
expected_brackets = {str(i) for i in range(1, N_BRACKETS + 1)}
assert set(thresholds.children) == expected_brackets
checked = set()

for bracket in sorted(thresholds.children, key=int):
columns = thresholds.children[bracket].children
joint, separate = columns["JOINT"], columns["SEPARATE"]
instants = sorted(
{
value_at_instant.instant_str
for leaf in (joint, separate)
for value_at_instant in leaf.values_list
}
)
for instant_str in instants:
joint_value = joint._get_at_instant(instant_str)
separate_value = separate._get_at_instant(instant_str)
if joint_value is None and separate_value is None:
continue
assert joint_value is not None and separate_value is not None, (
bracket,
instant_str,
)
assert separate_value == joint_value / 2, (
f"{BRACKET}.thresholds.{bracket}: SEPARATE {separate_value} "
f"does not equal half JOINT {joint_value} at {instant_str}"
)
checked.add(bracket)

assert checked == expected_brackets


# ---------------------------------------------------------------------------
# The reform in simulations
# ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
the SEPARATE-specific reform under test.
"""

import gc

import numpy as np
import pytest

Expand Down Expand Up @@ -194,15 +196,14 @@ def four_status_situation():


def test_shipped_additional_tax_bracket_reform_is_clamped():
# The contrib reform replaces both bracket loops and its parameter
# tree still carries the expiration projection's inverted SEPARATE
# thresholds (bracket 5 top 541,550 above bracket 6 top 305,875),
# so it must clamp too: before the fix a zero-income 2026 MFS filer
# owed a flat −$82,486 under this shipped reform. The reform's
# user-supplied extra bracket is filled as in its own yaml tests;
# brackets 1–6 stay at the shipped (inverted) values.
# Inject a SEPARATE bracket-5 top of 541,550 above bracket 6's 305,875
# to exercise the contrib reform's shared bracket clamp. Fill the
# user-supplied extra bracket as in the reform's YAML tests.
fill_extra_bracket = Reform.from_dict(
{
"gov.contrib.additional_tax_bracket.bracket.thresholds.5.SEPARATE": {
"2026-01-01.2026-12-31": 541_550
},
"gov.contrib.additional_tax_bracket.bracket.thresholds.7.SEPARATE": {
"2026-01-01.2026-12-31": 800_000
},
Expand All @@ -220,3 +221,19 @@ def test_shipped_additional_tax_bracket_reform_is_clamped():
before_credits = sim.calculate("income_tax_before_credits", 2026)[0]
assert main == 0
assert before_credits == 0
del sim
gc.collect()

# A zero-income filer owes nothing under any non-negative loop, so also
# check a filer inside the inverted band. Clamped, bracket 6 is empty and
# 151,625-400,000 is all taxed at bracket 5's 33%: 115,896.25. Without
# the inversion the tax is 122,810.50, and an unclamped loop gives yet
# another figure.
situation = separate_filer(0)
situation["tax_units"]["tu"]["taxable_income"] = {"2026": 400_000}
sim = Simulation(
reform=(fill_extra_bracket, additional_tax_bracket), situation=situation
)
assert sim.calculate("income_tax_main_rates", 2026)[0] == pytest.approx(
115_896.25, abs=0.01
)
Loading
Loading