Skip to content

Commit 1a7b557

Browse files
committed
include preTP objects in aggregates tests
1 parent 891f170 commit 1a7b557

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/test_aggregates.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def test_get_I(b_splus1, K_p1, K, p, method, expected):
151151
"omega": np.ones((160, 40)) / 40,
152152
"omega_SS": np.ones(40) / 40,
153153
"imm_rates": np.zeros((160, 40)),
154+
"omega_S_preTP": np.ones(40) / 40,
155+
"imm_rates_preTP": np.zeros(40),
156+
"rho_preTP": rho_vec[0, :],
157+
"g_n_preTP": 0.01,
154158
}
155159
# update parameters instance with new values for test
156160
p.update_specifications(new_param_values)
@@ -173,7 +177,7 @@ def test_get_I(b_splus1, K_p1, K, p, method, expected):
173177
expected2 = B_test.sum(1).sum(1) / (
174178
1.0 + np.hstack((p.g_n[1 : p.T], p.g_n_ss))
175179
)
176-
expected3 = B_test[0, :, :].sum() / (1.0 + p.g_n[0])
180+
expected3 = B_test[0, :, :].sum() / (1.0 + p.g_n_preTP)
177181
test_data = [
178182
(b[-1, :, :], p, "SS", False, expected1),
179183
(b, p, "TPI", False, expected2),
@@ -210,7 +214,10 @@ def test_get_B(b, p, method, PreTP, expected):
210214
"omega": np.ones((160, 40)) / 40,
211215
"omega_SS": np.ones(40) / 40,
212216
"imm_rates": np.zeros((160, 40)),
213-
"rho": rho_vec.tolist(),
217+
"omega_S_preTP": np.ones(40) / 40,
218+
"imm_rates_preTP": np.zeros(40),
219+
"rho_preTP": rho_vec[0, :],
220+
"g_n_preTP": 0.01,
214221
}
215222
# update parameters instance with new values for test
216223
p.update_specifications(new_param_values)
@@ -223,15 +230,16 @@ def test_get_B(b, p, method, PreTP, expected):
223230
np.reshape(p.rho[0, :] * pop, (p.T, p.S, 1)), (1, 1, p.J)
224231
)
225232
growth_adj = (1.0 + r) / (1.0 + p.g_n[: p.T])
233+
growth_adj_preTP = (1.0 + r[0]) / (1.0 + p.g_n_preTP)
226234

227235
expected1 = BQ_presum[-1, :, :].sum(0) * growth_adj[-1]
228236
expected2 = BQ_presum[-1, :, 1].sum(0) * growth_adj[-1]
229237
expected3 = BQ_presum.sum(1) * np.tile(
230238
np.reshape(growth_adj, (p.T, 1)), (1, p.J)
231239
)
232240
expected4 = BQ_presum[:, :, 1].sum(1) * growth_adj
233-
expected5 = BQ_presum[0, :, :].sum(0) * growth_adj[0]
234-
expected6 = BQ_presum[0, :, 1].sum(0) * growth_adj[0]
241+
expected5 = BQ_presum[0, :, :].sum(0) * growth_adj_preTP
242+
expected6 = BQ_presum[0, :, 1].sum(0) * growth_adj_preTP
235243

236244
p2 = copy.deepcopy(p)
237245
p2.use_zeta = True

0 commit comments

Comments
 (0)