From a310fa22cc17842e8b2ec88e2b033da4cb5641e2 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 11 Oct 2026 11:07:49 -0400 Subject: [PATCH 1/2] Assert the 2023-24 lower profits limit alignment instead of expecting it to fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #1968 (the model's 2023-24 Class 4 LPL was £11,908, not the £12,570 NICA 2022 s2 sets from 6 April 2023) was fixed by #2058 on 10 October. The non-strict xfail kept for it now passes silently as an XPASS, so the alignment test protected nothing for that year. Remove the marker so a regression to £11,908 fails the suite. Co-Authored-By: Claude Opus 5.5 --- .../remove-stale-xfail-1968.changed.md | 1 + .../tests/test_threshold_indexation.py | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) create mode 100644 changelog.d/remove-stale-xfail-1968.changed.md diff --git a/changelog.d/remove-stale-xfail-1968.changed.md b/changelog.d/remove-stale-xfail-1968.changed.md new file mode 100644 index 0000000000..8c89b101f7 --- /dev/null +++ b/changelog.d/remove-stale-xfail-1968.changed.md @@ -0,0 +1 @@ +- Removed the stale non-strict expected failure for the 2023-24 Class 4 lower profits limit (#1968, fixed by #2058), so the alignment test now asserts that year. diff --git a/policyengine_uk/tests/test_threshold_indexation.py b/policyengine_uk/tests/test_threshold_indexation.py index 01d5396e02..23211c9960 100644 --- a/policyengine_uk/tests/test_threshold_indexation.py +++ b/policyengine_uk/tests/test_threshold_indexation.py @@ -35,8 +35,7 @@ £0.26 of the UPL. From 2023: LPL = PA and 52 x PT is within £0.26 of the LPL. Intended exceptions, as the law stood: in 2021-22 the PT and LPL were £9,568 a year, below the PA; in 2022-23 the PT rose to the PA only - from 6 July 2022 and the LPL was £11,908 for the whole year. The model's - 2023-24 LPL (£11,908, not £12,570) is #1968. + from 6 July 2022 and the LPL was £11,908 for the whole year. 6. Secondary threshold: from 2031, ST(Y) = ST(Y-1) x (1 + g_Y). 7. For any freeze end and September CPI path (function level): values up to each parameter's last stated year are unchanged; after it, each NICs @@ -322,19 +321,9 @@ def test_upper_thresholds_align_with_the_higher_rate_threshold(system, year): ) -@pytest.mark.parametrize( - "year", - [ - pytest.param( - 2023, - marks=pytest.mark.xfail( - reason="#1968: the model's 2023-24 LPL is £11,908, not £12,570", - strict=False, - ), - ), - *range(2024, 2041), - ], -) +# 2023-24 is the first aligned year: NICA 2022 s2 set the LPL to £12,570 +# from 6 April 2023 (#1968, fixed by #2058). +@pytest.mark.parametrize("year", range(2023, 2041)) def test_lower_thresholds_align_with_the_personal_allowance(system, year): values = thresholds(system, year) assert values["lower_profits_limit"] == pytest.approx( From 7f7fc5d1911c6b751c6a957a339f93186edb235e Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 11 Oct 2026 11:54:08 -0400 Subject: [PATCH 2/2] Drop the #1968 exception from the NI threshold freeze test's invariants too The sibling module repeated the 2023-24 lower profits limit as an open defect (#1968); #2058 fixed it. Co-Authored-By: Claude Opus 5.5 --- policyengine_uk/tests/test_ni_threshold_freeze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_uk/tests/test_ni_threshold_freeze.py b/policyengine_uk/tests/test_ni_threshold_freeze.py index 0403c92137..43cceb3712 100644 --- a/policyengine_uk/tests/test_ni_threshold_freeze.py +++ b/policyengine_uk/tests/test_ni_threshold_freeze.py @@ -26,7 +26,7 @@ 4. Alignment, in test_threshold_indexation.py: the UEL and UPL with the higher rate threshold in every year 2021-2040, and the PT and LPL with the personal allowance from 2023. The 2021-22 and 2022-23 lower thresholds - are intended exceptions, and the 2023-24 LPL is #1968. + are intended exceptions. 5. No cash cuts: no threshold falls from one year to the next, 2026-2040. 6. Differential: for any earnings or profits >= 0 in 2026-2030, primary and additional Class 1, secondary Class 1 and Class 4 equal an exact-rational