Repository: PolicyEngine/policyengine-uk (language: python)

Issue:
Add switch to preserve pensioners' higher rate threshold



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bbb271245..beffe25e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.13.0] - 2022-02-28
+
+### Added
+
+- Pensioner exemption switch for Income Tax rate and threshold reforms.
+
 ## [0.12.4] - 2022-02-25
 
 ### Added
diff --git a/openfisca_uk/parameters/__init__.py b/openfisca_uk/parameters/__init__.py
new file mode 100644
index 000000000..403148271
--- /dev/null
+++ b/openfisca_uk/parameters/__init__.py
@@ -0,0 +1,3 @@
+from openfisca_uk.system import CountryTaxBenefitSystem
+
+parameters = CountryTaxBenefitSystem().parameters
diff --git a/openfisca_uk/parameters/contrib/ubi_center/basic_income/exempt_pensioners_from_tax_changes.yaml b/openfisca_uk/parameters/contrib/ubi_center/basic_income/exempt_pensioners_from_tax_changes.yaml
new file mode 100644
index 000000000..7030c9bd4
--- /dev/null
+++ b/openfisca_uk/parameters/contrib/ubi_center/basic_income/exempt_pensioners_from_tax_changes.yaml
@@ -0,0 +1,5 @@
+description: Exempt individuals over State Pension age from all reforms to labour income tax rates and thresholds.
+values:
+  2010-01-01: false
+metadata:
+  label: Exempt pensioners from Income Tax reforms
diff --git a/openfisca_uk/variables/finance/tax/income_tax/liability.py b/openfisca_uk/variables/finance/tax/income_tax/liability.py
index 19a08e7a2..dacd81a34 100644
--- a/openfisca_uk/variables/finance/tax/income_tax/liability.py
+++ b/openfisca_uk/variables/finance/tax/income_tax/liability.py
@@ -459,12 +459,30 @@ class income_tax_pre_charges(Variable):
     unit = "currency-GBP"
 
     def formula(person, period, parameters):
-        COMPONENTS = [
-            "earned_income_tax",
+        earned_tax = person("earned_income_tax", period)
+
+        if parameters(
+            period
+        ).contrib.ubi_center.basic_income.exempt_pensioners_from_tax_changes:
+            from openfisca_uk.parameters import (
+                parameters as baseline_parameters,
+            )
+
+            baseline_earned_income_tax = (
+                person.simulation.tax_benefit_system.variables[
+                    "earned_income_tax"
+                ].get_formula(period)(person, period, baseline_parameters)
+            )
+            is_sp_age = person("is_SP_age", period)
+            earned_tax = where(
+                is_sp_age, baseline_earned_income_tax, earned_tax
+            )
+
+        OTHER_COMPONENTS = [
             "savings_income_tax",
             "dividend_income_tax",
         ]
-        return add(person, period, COMPONENTS)
+        return earned_tax + add(person, period, OTHER_COMPONENTS)
 
 
 class is_higher_earner(Variable):
diff --git a/setup.py b/setup.py
index 96f1567e0..42feafdc2 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
 
 setup(
     name="OpenFisca-UK",
-    version="0.12.4",
+    version="0.13.0",
     author="PolicyEngine",
     author_email="nikhil@policyengine.org",
     classifiers=[


Test patch:
diff --git a/openfisca_uk/tests/policy/reforms/parametric/pensioner_tax_reform_exemption.yaml b/openfisca_uk/tests/policy/reforms/parametric/pensioner_tax_reform_exemption.yaml
new file mode 100644
index 000000000..df01bb5d1
--- /dev/null
+++ b/openfisca_uk/tests/policy/reforms/parametric/pensioner_tax_reform_exemption.yaml
@@ -0,0 +1,27 @@
+- name: No changes, initial tax computation to generate a baseline against which to test the reform.
+  period: 2021
+  input:
+    people:
+      pensioner:
+        age: 70
+        pension_income: 20_000
+      adult:
+        age: 30
+        employment_income: 20_000
+  output:
+    income_tax: [1_500, 1_500]
+
+- name: Basic rate increase, with one pensioner (exempt) and one working-age adult (not exempt).
+  period: 2021
+  input:
+    tax.income_tax.rates.uk[0].rate: 0.5
+    contrib.ubi_center.basic_income.exempt_pensioners_from_tax_changes: true
+    people:
+      pensioner:
+        age: 70
+        pension_income: 20_000
+      adult:
+        age: 30
+        employment_income: 20_000
+  output:
+    income_tax: [1_500, 3_750]