Skip to content

Commit

Permalink
add tests to check that multi-db integration works
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Jan 8, 2019
1 parent a0f1f05 commit 15ddb5d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ def test_run_gams_api():
assert np.isclose(obs, exp)


def scenario_list(mp):
return mp.scenario_list(default=False)[['model', 'scenario']]


def assert_multi_db(mp1, mp2):
pd.testing.assert_frame_equal(scenario_list(mp1), scenario_list(mp2))


def test_multi_db_run():
mp1 = ixmp.Platform(tempdir(), dbtype='HSQLDB')
scen1 = make_scenario(mp1)
Expand All @@ -111,6 +119,7 @@ def test_multi_db_run():
solve_scenario(scen2)

assert scen1.var('z') == scen2.var('z')
assert_multi_db(mp1, mp2)


def test_multi_db_edit_source():
Expand Down Expand Up @@ -144,6 +153,8 @@ def test_multi_db_edit_source():
exp = 1.4
assert np.isclose(obs, exp)

assert_multi_db(mp1, mp2)


def test_multi_db_edit_target():
mp1 = ixmp.Platform(tempdir(), dbtype='HSQLDB')
Expand Down Expand Up @@ -175,3 +186,5 @@ def test_multi_db_edit_target():
)
exp = 1.4
assert np.isclose(obs, exp)

assert_multi_db(mp1, mp2)

0 comments on commit 15ddb5d

Please sign in to comment.