Skip to content

Commit 1642c33

Browse files
committed
Fix asserts
1 parent 698e5e8 commit 1642c33

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/test_build_particles_normalized.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def test_build_particles_normalized_match_at_s(test_context):
191191
particles.move(_context=xo.context_default)
192192
assert (np.unique(particles.at_element[particles.state>0])[0]
193193
== line.element_names.index('match_at_s'))
194-
xo.assert_allclose(particles.x, 0.02, atol=1e-20)
194+
xo.assert_allclose(particles.x, 0.02, atol=1e-14, rtol=0)
195195

196196

197197
@for_all_test_contexts
@@ -221,10 +221,10 @@ def test_build_perticles_dispersion(test_context):
221221
xo.assert_allclose((particles.x-tw.x[0])/particles.delta, tw.dx[0],
222222
atol=5e-3, rtol=0)
223223

224-
xo.assert_allclose(norm_coords['x_norm'], 0, 1e-12)
225-
xo.assert_allclose(norm_coords['px_norm'], 0, 1e-12)
226-
xo.assert_allclose(norm_coords['y_norm'], 0, 1e-12)
227-
xo.assert_allclose(norm_coords['py_norm'], 0, 1e-12)
224+
xo.assert_allclose(norm_coords['x_norm'], 0, atol=1e-12)
225+
xo.assert_allclose(norm_coords['px_norm'], 0, atol=1e-12)
226+
xo.assert_allclose(norm_coords['y_norm'], 0, atol=1e-12)
227+
xo.assert_allclose(norm_coords['py_norm'], 0, atol=1e-12)
228228

229229
particles = line.build_particles(nemitt_x=3e-6, nemitt_y=3e-6,
230230
x=[1e-3, -1e-3], x_norm=[0.3, 0.4], px_norm=[0.5, 0.6],

tests/test_pencil_with_absolute_cut.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def test_pencil_with_absolute_cut(test_context):
112112
w_norm = getattr(norm_coords, other_plane+'_norm')
113113
pw_norm = getattr(norm_coords, 'p'+other_plane+'_norm')
114114

115-
xo.assert_allclose(w_in_sigmas, w_norm, 1e-12)
116-
xo.assert_allclose(pw_in_sigmas, pw_norm, 1e-12)
115+
xo.assert_allclose(w_in_sigmas, w_norm, atol=1e-12, rtol=1e-7)
116+
xo.assert_allclose(pw_in_sigmas, pw_norm, atol=1e-12, rtol=1e-7)
117117

118-
xo.assert_allclose(zeta, particles.zeta, atol=1e-12)
119-
xo.assert_allclose(delta, particles.delta, atol=1e-12)
118+
xo.assert_allclose(zeta, particles.zeta, atol=1e-12, rtol=1e-7)
119+
xo.assert_allclose(delta, particles.delta, atol=1e-12, rtol=1e-7)

0 commit comments

Comments
 (0)