Skip to content

Commit 23f93a9

Browse files
committed
Simplify Test
1 parent 3792a34 commit 23f93a9

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

tests/test_parameters.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -134,53 +134,3 @@ def test_ParameterClasses():
134134
# Test BeamBeamParameters
135135
beambeam = BeamBeamParameters()
136136
assert beambeam is not None
137-
138-
139-
def test_multipole_numpy_coercion():
140-
"""Regression test for issue #67: numpy scalars passed to multipole parameter
141-
classes must be coerced to Python-native numeric types at construction time,
142-
so YAML/JSON serialization produces clean output regardless of input type."""
143-
np = pytest.importorskip("numpy")
144-
145-
# MagneticMultipoleParameters: cover all prefixes and several numpy dtypes
146-
mmp = MagneticMultipoleParameters(
147-
tilt1=np.float64(0.1),
148-
Bn1=np.float64(1.5),
149-
Bn2=np.float32(2.5),
150-
Bs1=np.int64(3),
151-
Kn0=np.int32(-1),
152-
Ks1=np.float64(0.25),
153-
)
154-
assert type(mmp.tilt1) is float and mmp.tilt1 == 0.1
155-
assert type(mmp.Bn1) is float and mmp.Bn1 == 1.5
156-
assert type(mmp.Bn2) is float and mmp.Bn2 == 2.5
157-
assert type(mmp.Bs1) is int and mmp.Bs1 == 3
158-
assert type(mmp.Kn0) is int and mmp.Kn0 == -1
159-
assert type(mmp.Ks1) is float and mmp.Ks1 == 0.25
160-
161-
# 0-d numpy array also works
162-
mmp_arr = MagneticMultipoleParameters(Bn1=np.array(4.2))
163-
assert type(mmp_arr.Bn1) is float and mmp_arr.Bn1 == 4.2
164-
165-
# Length-integrated variants
166-
mmp_L = MagneticMultipoleParameters(Bn1L=np.float64(7.0), Ks1L=np.float64(8.0))
167-
assert type(mmp_L.Bn1L) is float and mmp_L.Bn1L == 7.0
168-
assert type(mmp_L.Ks1L) is float and mmp_L.Ks1L == 8.0
169-
170-
# ElectricMultipoleParameters: cover all prefixes
171-
emp = ElectricMultipoleParameters(
172-
tilt1=np.float64(0.2),
173-
En1=np.float64(0.5),
174-
Es1=np.int64(2),
175-
)
176-
assert type(emp.tilt1) is float and emp.tilt1 == 0.2
177-
assert type(emp.En1) is float and emp.En1 == 0.5
178-
assert type(emp.Es1) is int and emp.Es1 == 2
179-
180-
emp_L = ElectricMultipoleParameters(En1L=np.float64(1.0), Es1L=np.float64(0.5))
181-
assert type(emp_L.En1L) is float and emp_L.En1L == 1.0
182-
assert type(emp_L.Es1L) is float and emp_L.Es1L == 0.5
183-
184-
# Plain Python values must still pass through unchanged
185-
mmp_plain = MagneticMultipoleParameters(Bn1=1.5)
186-
assert type(mmp_plain.Bn1) is float and mmp_plain.Bn1 == 1.5

0 commit comments

Comments
 (0)