Skip to content

Commit 13b5d1f

Browse files
Added test of duplicate with regex/wildcards in the config
1 parent 0fd2a87 commit 13b5d1f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
type: pyaml.accelerator
2+
facility: ESRF
3+
machine: sr
4+
energy: 6e9
5+
simulators:
6+
- type: pyaml.lattice.simulator
7+
lattice: sr/lattices/ebs.mat
8+
name: design
9+
data_folder: /data/store
10+
arrays:
11+
- type: pyaml.arrays.magnet
12+
name: HCORR
13+
elements:
14+
- SH1A-C0?-H
15+
- SH1A-C02-H # duplicate name in array
16+
- type: pyaml.arrays.magnet
17+
name: VCORR
18+
elements:
19+
- SH1A-C01-V
20+
- SH1A-C02-V
21+
devices:
22+
- sr/quadrupoles/QF1AC01.yaml
23+
- sr/correctors/SH1AC01.yaml
24+
- sr/correctors/SH1AC02.yaml

tests/test_errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ def test_tune(install_test_package):
2424
assert "element BPM_C04-06 already defined" in str(exc)
2525
assert "line 58, column 3" in str(exc)
2626

27+
with pytest.raises(PyAMLConfigException) as exc:
28+
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_4.yaml")
29+
assert "MagnetArray HCORR : duplicate name SH1A-C02-H @index 2" in str(exc)
30+
2731
sr: Accelerator = Accelerator.load("tests/config/EBSTune.yaml")
2832
m1 = sr.live.get_magnet("QF1E-C04")
2933
m2 = sr.design.get_magnet("QF1A-C05")

0 commit comments

Comments
 (0)