Skip to content

Commit

Permalink
Replace config_advanced with config_minimal in test_config_branch_pre…
Browse files Browse the repository at this point in the history
…serves_config_section_order
  • Loading branch information
DanSava committed Jan 15, 2025
1 parent ea1a5e1 commit 3c44846
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
21 changes: 8 additions & 13 deletions test-data/everest/math_func/config_minimal.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
controls:
-
name: point
- name: point
type: generic_control
min: -1.0
max: 1.0
initial_guess: 0.1
perturbation_magnitude : 0.001
perturbation_magnitude: 0.001
variables:
- name: x
- name: y
- name: z
- name: x
- name: y
- name: z


objective_functions:
-
name: distance
- name: distance


optimization:
Expand All @@ -25,17 +23,14 @@ optimization:


install_jobs:
-
name: distance3
- name: distance3
source: jobs/DISTANCE3

model:
realizations: [0]

forward_model:
- distance3 --point-file point.json
--target 0.5 0.5 0.5
--out distance
- distance3 --point-file point.json --target 0.5 0.5 0.5 --out distance

environment:
simulation_folder: sim_output
Expand Down
8 changes: 3 additions & 5 deletions tests/everest/entry_points/test_config_branch_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ def test_config_branch_entry(cached_example):


def test_config_branch_preserves_config_section_order(cached_example):
path, _, _ = cached_example("math_func/config_advanced.yml")
path, _, _ = cached_example("math_func/config_minimal.yml")

config_branch_entry(["config_advanced.yml", "new_restart_config.yml", "-b", "1"])
config_branch_entry(["config_minimal.yml", "new_restart_config.yml", "-b", "1"])

assert exists("new_restart_config.yml")

opt_controls = {}

snapshot = SebaSnapshot(Path(path) / "everest_output" / "optimization_output")
Expand All @@ -61,7 +60,7 @@ def test_config_branch_preserves_config_section_order(cached_example):

diff_lines = []
with (
open("config_advanced.yml", encoding="utf-8") as initial_config,
open("config_minimal.yml", encoding="utf-8") as initial_config,
open("new_restart_config.yml", encoding="utf-8") as branch_config,
):
diff = difflib.unified_diff(
Expand All @@ -79,6 +78,5 @@ def test_config_branch_preserves_config_section_order(cached_example):
diff_lines.append(line.replace(" ", "").strip())

assert len(diff_lines) == 4
assert "-initial_guess:0.25" in diff_lines
for control_val in opt_control_val_for_batch_id:
assert f"+initial_guess:{control_val}" in diff_lines

0 comments on commit 3c44846

Please sign in to comment.