File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1+ - bump : patch
2+ changes :
3+ added :
4+ - Unit test for GeneralEconomyTask.calculate_cliffs() and fixture for the test
5+ - Test for calculate_single_economy with cliff impacts
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ def test_us_macro_comparison():
2222
2323 sim .calculate_economy_comparison ()
2424
25+
2526def test_us_macro_cliff_impacts ():
2627 from policyengine import Simulation
2728
@@ -31,13 +32,15 @@ def test_us_macro_cliff_impacts():
3132 reform = {
3233 "gov.usda.snap.income.deductions.earned_income" : {"2025" : 0.05 }
3334 },
34- include_cliffs = True
35+ include_cliffs = True ,
3536 )
3637
3738 result = sim .calculate_economy_comparison ()
38- cliff_impact = result .model_dump ().get (' cliff_impact' )
39+ cliff_impact = result .model_dump ().get (" cliff_impact" )
3940
40- assert cliff_impact is not None , "Expected 'cliff_impact' to be present in the output."
41+ assert (
42+ cliff_impact is not None
43+ ), "Expected 'cliff_impact' to be present in the output."
4144
4245 assert cliff_impact ["baseline" ]["cliff_gap" ] > 0
4346 assert cliff_impact ["reform" ]["cliff_share" ] > 0
Original file line number Diff line number Diff line change 1111from copy import deepcopy
1212
1313from policyengine import Simulation
14- from policyengine .outputs .macro .single .calculate_single_economy import GeneralEconomyTask
14+ from policyengine .outputs .macro .single .calculate_single_economy import (
15+ GeneralEconomyTask ,
16+ )
1517
1618
1719class TestSimulation :
@@ -73,9 +75,10 @@ def test__given_dataset_without_time_period__does_not_set_time_period(
7375 == None
7476 )
7577
76-
7778 class TestCalculateCliffs :
78- def test__calculates_correct_cliff_metrics (self , mock_simulation_with_cliff_vars ):
79+ def test__calculates_correct_cliff_metrics (
80+ self , mock_simulation_with_cliff_vars
81+ ):
7982
8083 task = object .__new__ (GeneralEconomyTask )
8184 task .simulation = mock_simulation_with_cliff_vars
You can’t perform that action at this time.
0 commit comments