@@ -87,7 +87,6 @@ def test_run_all(mocker):
8787 )
8888 gr_m = mocker .patch ("nhp.model.run.generate_results_json" , return_value = "results_json_path" )
8989 sr_m = mocker .patch ("nhp.model.run.save_results_files" , return_value = "results_paths" )
90- nd_m = mocker .patch ("nhp.model.run.Local" )
9190
9291 pc_m = Mock ()
9392 pc_m ().return_value = "progress callback"
@@ -102,16 +101,15 @@ def test_run_all(mocker):
102101 "model_runs" : 10 ,
103102 "create_datetime" : "20230123_012345" ,
104103 }
104+ data_mock = Mock (return_value = "nhp_data" )
105105
106106 # act
107- actual = run_all (params , "data_path" , pc_m , False )
107+ actual = run_all (params , data_mock , pc_m , False )
108108
109109 # assert
110110 assert actual == ("results_paths" , "results_json_path" )
111111
112- nd_m .create .assert_called_once_with ("data_path" )
113- nd_c = nd_m .create ()
114- nd_c .assert_called_once_with (2020 , "synthetic" )
112+ data_mock .assert_called_once_with (2020 , "synthetic" )
115113
116114 assert pc_m .call_args_list == [
117115 call ("Inpatients" ),
@@ -120,13 +118,13 @@ def test_run_all(mocker):
120118 ]
121119
122120 grp_m .assert_called_once_with (params )
123- hsa_m .assert_called_once_with (nd_c ( 2020 , "synthetic" ) , 2020 )
121+ hsa_m .assert_called_once_with ("nhp_data" , 2020 )
124122
125123 assert rm_m .call_args_list == [
126124 call (
127125 m ,
128126 params ,
129- nd_c ,
127+ data_mock ,
130128 "hsa" ,
131129 {"variant" : "variants" },
132130 pc_m (),
@@ -136,15 +134,12 @@ def test_run_all(mocker):
136134 ]
137135
138136 cr_m .assert_called_once_with (["ip" , "op" , "aae" ])
139- # weaker form of checking, but as we intended to drop this function in the future don't expend
140- # effort to fixing this part of the test
141- gr_m .assert_called_once ()
142- # gr_m.assert_called_once_with(
143- # {"default": "combined_results"},
144- # "combined_step_counts",
145- # params,
146- # {"variant": "variants"},
147- # )
137+ gr_m .assert_called_once_with (
138+ {"default" : "combined_results" , "step_counts" : "combined_step_counts" },
139+ "combined_step_counts" ,
140+ params ,
141+ {"variant" : "variants" },
142+ )
148143 sr_m .assert_called_once_with (
149144 {"default" : "combined_results" , "step_counts" : "combined_step_counts" }, params
150145 )
0 commit comments