Skip to content

Commit 04f3010

Browse files
committed
test coverage for when ping api and when not
1 parent fc53719 commit 04f3010

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

tests/test_macro_params.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,36 @@
22
Tests of macro_params.py module
33
"""
44

5-
from ogzaf import macro_params
5+
import pytest
6+
from ogidn import macro_params
67

78

8-
def test_get_macro_params():
9-
test_dict = macro_params.get_macro_params()
9+
@pytest.mark.parametrize(
10+
"update_from_api",
11+
[True, False],
12+
ids=["update_from_api=True", "update_from_api=False"],
13+
)
14+
def test_get_macro_params(update_from_api):
15+
test_dict = macro_params.get_macro_params(update_from_api=update_from_api)
1016

1117
assert isinstance(test_dict, dict)
12-
assert (
13-
list(test_dict.keys()).sort()
14-
== [
15-
"r_gov_shift",
16-
"r_gov_scale",
17-
"alpha_T",
18-
"alpha_G",
19-
"initial_debt_ratio",
20-
"g_y_annual",
21-
"gamma",
22-
"zeta_D",
23-
"initial_foreign_debt_ratio",
24-
].sort()
25-
)
18+
if update_from_api:
19+
assert (
20+
list(test_dict.keys()).sort()
21+
== [
22+
"r_gov_shift",
23+
"r_gov_scale",
24+
"alpha_T",
25+
"alpha_G",
26+
"initial_debt_ratio",
27+
"g_y_annual",
28+
"gamma",
29+
"zeta_D",
30+
"initial_foreign_debt_ratio",
31+
].sort()
32+
)
33+
else:
34+
assert (
35+
list(test_dict.keys()).sort()
36+
== ["r_gov_shift", "r_gov_scale"].sort()
37+
)

0 commit comments

Comments
 (0)