33
44from pyaml import PyAMLException
55from pyaml .accelerator import Accelerator
6- from pyaml .configuration .factory import Factory
76
87
98def _in_range (vmin , vmax ) -> float :
@@ -21,7 +20,9 @@ def _out_of_range(vmin, vmax) -> float:
2120 return float (vmax ) + 0.1
2221 if vmin is not None :
2322 return float (vmin ) - 0.1
24- raise RuntimeError ("Unbounded range [None, None], cannot build an out-of-range value." )
23+ raise RuntimeError (
24+ "Unbounded range [None, None], cannot build an out-of-range value."
25+ )
2526
2627
2728@pytest .mark .parametrize (
@@ -34,7 +35,9 @@ def _out_of_range(vmin, vmax) -> float:
3435 ],
3536 indirect = ["install_test_package" ],
3637)
37- def test_cfm_ranges_from_yaml_are_propagated_and_enforced (magnet_file , install_test_package ):
38+ def test_cfm_ranges_from_yaml_are_propagated_and_enforced (
39+ magnet_file , install_test_package
40+ ):
3841 sr : Accelerator = Accelerator .load (magnet_file )
3942 sr .design .get_lattice ().disable_6d ()
4043
@@ -55,11 +58,13 @@ def test_cfm_ranges_from_yaml_are_propagated_and_enforced(magnet_file, install_t
5558 assert got_ranges == expected_ranges
5659
5760 # Build an in-range current vector (3 values)
58- in_currents = np .array ([
59- _in_range (* expected_ranges [0 ]),
60- _in_range (* expected_ranges [1 ]),
61- _in_range (* expected_ranges [2 ]),
62- ])
61+ in_currents = np .array (
62+ [
63+ _in_range (* expected_ranges [0 ]),
64+ _in_range (* expected_ranges [1 ]),
65+ _in_range (* expected_ranges [2 ]),
66+ ]
67+ )
6368
6469 # Convert currents -> strengths (vector size 3)
6570 in_strengths = m .model .compute_strengths (in_currents )
@@ -73,5 +78,3 @@ def test_cfm_ranges_from_yaml_are_propagated_and_enforced(magnet_file, install_t
7378
7479 with pytest .raises (PyAMLException , match = "out of range" ):
7580 m .strengths .set (out_strengths )
76-
77- Factory .clear ()
0 commit comments