Skip to content

Commit 7d89efb

Browse files
committed
fixing tests
1 parent a30f323 commit 7d89efb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/examples/test_examples.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,16 @@ def test_simulation(self, example_md6863: Path):
235235
xing_configs = list(md6863.XingSchemes.keys())
236236
assert len(xing_configs) == 4
237237

238-
lhc_beams = md6863.simulation()
238+
lhc_beams_per_setup = md6863.simulation()
239239
_check_simulation_output(output_dir, suffixes=xing_configs)
240240

241-
md6863.do_correction(lhc_beams=lhc_beams)
241+
md6863.do_correction(lhc_beams_per_setup)
242242
_check_correction_output(output_dir, self.INPUT_DIR)
243243

244-
md6863.check_correction(lhc_beams=lhc_beams)
244+
md6863.check_correction(lhc_beams_per_setup)
245245
_check_correction_ptc_check_output(output_dir, self.INPUT_DIR)
246246

247-
for beam in lhc_beams.values():
247+
for beam in lhc_beams_per_setup.values():
248248
beam.madx.exit()
249249

250250
@pytest.mark.dependency(depends=["TestExamplesMD6863::test_simulation"])
@@ -321,7 +321,7 @@ def _clear_correction_output(output_dir: Path):
321321
def _check_correction_output(output_dir: Path, compare_dir: Path):
322322
"""Check that correction output files are created."""
323323
target_ids = _get_target_ids(compare_dir)
324-
assert len(target_ids) == 3, "No settings found to compare test run to." # test sanity check
324+
assert len(target_ids) > 0, "No settings found to compare test run to." # test sanity check
325325

326326
for target_id in target_ids:
327327
# Compare Expected Settings ---
@@ -331,10 +331,15 @@ def _check_correction_output(output_dir: Path, compare_dir: Path):
331331
assert_frame_equal(df_new, df_compare, rtol=1e-2, atol=1e-2)
332332

333333
# Check files present ---
334-
for prefix in ("settings", "ampdet_calc", "ampdet_calc_err"):
334+
for prefix in ("settings", "ampdet_calc"):
335335
for beam in (1, 4):
336336
assert_exists_and_not_empty(output_dir / f"{prefix}.lhc.b{beam}.{target_id}.tfs")
337337

338+
# Check ampdet-with-error files when numpy-solver was used.
339+
if "constrain" not in target_id: # NOTE: naming convention for current examples!
340+
for beam in (1, 4):
341+
assert_exists_and_not_empty(output_dir / f"ampdet_calc_err.lhc.b{beam}.{target_id}.tfs")
342+
338343
# Compare Beams Settings ---
339344
b1_files = list(output_dir.glob("settings.lhc.b1*"))
340345
b4_files = list(output_dir.glob("settings.lhc.b4*"))

0 commit comments

Comments
 (0)