Skip to content

Commit 0cbbfb8

Browse files
committed
change to relative tolerance
1 parent 49f10a3 commit 0cbbfb8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

policyengine_us_data/tests/test_datasets/test_enhanced_cps.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ def apply(self):
7272

7373
# Calculate tax expenditure
7474
tax_expenditure = (income_tax_r - income_tax_b).sum()
75+
pct_error = abs((tax_expenditure - target) / target)
76+
TOLERANCE = 0.15
7577

76-
# Assert within 5bn of target
7778
assert (
78-
abs(tax_expenditure - target) < 5e9
79-
), f"{deduction} tax expenditure {tax_expenditure/1e9:.1f}bn differs from target {target/1e9:.1f}bn by more than 5bn"
79+
pct_error < TOLERANCE
80+
), f"{deduction} tax expenditure {tax_expenditure/1e9:.1f}bn differs from target {target/1e9:.1f}bn by {pct_error:.2%}"

0 commit comments

Comments
 (0)