@@ -82,7 +82,6 @@ def __init__(self, test, **kwargs) -> None:
82
82
super ().__init__ (name = "" , path = "" , baseline_tax_benefit_system = TaxBenefitSystem (), test = test , options = {}, ** kwargs )
83
83
84
84
self .tax_benefit_system : TaxBenefitSystem = self .baseline_tax_benefit_system
85
- self .simulation = Simulation ()
86
85
87
86
88
87
class TestVariable (Variable ):
@@ -206,20 +205,27 @@ def test_performance_tables_option_output() -> None:
206
205
clean_performance_files (paths )
207
206
208
207
209
- def test_trace () -> None :
208
+ def test_trace (capsys ) -> None :
210
209
testFile = TestFile .from_parent (parent = None )
211
210
test = {
212
211
"input" : {"salary" : {"2017-01" : 2000 }},
213
212
"output" : {"salary" : {"2017-01" : 2000 }},
214
213
}
215
214
test_item = TestItem .from_parent (parent = testFile , test = test )
216
- test_item . options = { "verbose" : True }
217
-
215
+
216
+ # TestItem init should instanciate the TaxBenefitSystem
218
217
assert test_item .tax_benefit_system .get_variable ("salary" ) is not None
219
-
218
+
219
+ test_item .options = {"verbose" : True }
220
220
test_item .runtest ()
221
-
222
- assert test_item .simulation .trace
221
+ captured = capsys .readouterr ()
222
+
223
+ # TestItem.runtest should set the trace attribute from the 'verbose' option
224
+ assert test_item .simulation .trace is True
225
+ assert test_item
226
+
227
+ # TestItem.runtest should run print_computation_log
228
+ assert captured .out is not ''
223
229
224
230
225
231
def clean_performance_files (paths : list [str ]) -> None :
0 commit comments