Skip to content

Commit 3414280

Browse files
authored
Make NI Class 3 a pure input (#1653)
1 parent ce9d4be commit 3414280

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from policyengine_uk import CountryTaxBenefitSystem
2+
3+
4+
def test_input_variables_do_not_use_defined_for():
5+
system = CountryTaxBenefitSystem()
6+
7+
invalid = {
8+
name: variable.defined_for
9+
for name, variable in system.variables.items()
10+
if variable.is_input_variable() and variable.defined_for is not None
11+
}
12+
13+
assert invalid == {}
14+
15+
16+
def test_input_variables_do_not_use_formulas_adds_or_subtracts():
17+
system = CountryTaxBenefitSystem()
18+
19+
invalid = {
20+
name: {
21+
"formulas": bool(getattr(variable, "formulas", None)),
22+
"adds": bool(getattr(variable, "adds", None)),
23+
"subtracts": bool(getattr(variable, "subtracts", None)),
24+
}
25+
for name, variable in system.variables.items()
26+
if variable.is_input_variable()
27+
and (
28+
getattr(variable, "formulas", None)
29+
or getattr(variable, "adds", None)
30+
or getattr(variable, "subtracts", None)
31+
)
32+
}
33+
34+
assert invalid == {}

policyengine_uk/variables/gov/hmrc/national_insurance/class_3/ni_class_3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ class ni_class_3(Variable):
88
definition_period = YEAR
99
value_type = float
1010
unit = GBP
11-
defined_for = "ni_liable"
1211
reference = "https://www.legislation.gov.uk/ukpga/1992/4/section/13"

0 commit comments

Comments
 (0)