Skip to content

Commit

Permalink
Replace usage of a deprecated function in a test
Browse files Browse the repository at this point in the history
  • Loading branch information
JHolba authored and berland committed Mar 14, 2024
1 parent ab97e82 commit c57b5e1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/unit_tests/test_summary_response.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import shutil
from pathlib import Path
from textwrap import dedent
Expand Down Expand Up @@ -26,7 +25,6 @@ def test_load_summary_response_restart_not_zero(tmpdir, snapshot, request, stora
)
with open("config.ert", "w", encoding="utf-8") as fh:
fh.writelines(config)
cwd = Path().absolute()
sim_path = Path("simulations") / "realization-0" / "iter-0"
ert_config = ErtConfig.from_file("config.ert")

Expand All @@ -49,15 +47,19 @@ def test_load_summary_response_restart_not_zero(tmpdir, snapshot, request, stora
)

create_run_path(prior, ert_config)
os.chdir(sim_path)
shutil.copy(test_path / "PRED_RUN.SMSPEC", "PRED_RUN.SMSPEC")
shutil.copy(test_path / "PRED_RUN.UNSMRY", "PRED_RUN.UNSMRY")
os.chdir(cwd)
shutil.copy(test_path / "PRED_RUN.SMSPEC", sim_path / "PRED_RUN.SMSPEC")
shutil.copy(test_path / "PRED_RUN.UNSMRY", sim_path / "PRED_RUN.UNSMRY")

facade = LibresFacade.from_config_file("config.ert")
facade.load_from_forward_model(ensemble, [True], 0)

df = ensemble.load_responses("summary", (0,)).to_dataframe()
df = df.unstack(level="name")
df.columns = [col[1] for col in df.columns.values]
df.index = df.index.rename(
{"time": "Date", "realization": "Realization"}
).reorder_levels(["Realization", "Date"])
snapshot.assert_match(
ensemble.load_all_summary_data().dropna().iloc[:, :15].to_csv(),
df.dropna().iloc[:, :15].to_csv(),
"summary_restart",
)

0 comments on commit c57b5e1

Please sign in to comment.