Skip to content

Commit

Permalink
TST: add rtol test
Browse files Browse the repository at this point in the history
  • Loading branch information
elcorto committed Jul 24, 2024
1 parent c6ab3f5 commit 1676ae7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,30 @@ def test_atol_std_xy_rise_increasing(
assert (conv.check_all(history * scale + offset) == bool_arr_ref).all()


@pytest.mark.parametrize(
"xy_func, cls, mode, pos_idx_ref",
[
(get_xy_fall_to_flat, SlopeZero, "min", 50),
(get_xy_fall_to_flat, SlopeZero, "abs", 50),
(get_xy_rise_to_flat, SlopeZero, "max", 43),
(get_xy_rise_to_flat, SlopeZero, "abs", 43),
],
)
@pytest.mark.parametrize("scale, offset", _gen_combos_scale_offset())
def test_rtol_xy_to_flat(xy_func, cls, mode, pos_idx_ref, scale, offset):
"""Show that rtol is invariant to scale, but not offset in terms of pos_idx."""
_, history = xy_func()

conv = cls(rtol=0.005, mode=mode, wlen=5)
hh = history * scale + offset
pos_idx = conv.check_first(hh)
if offset == 0:
assert pos_idx == pos_idx_ref
else:
assert not pos_idx == pos_idx_ref
assert conv.check(hh)


@pytest.mark.parametrize(
"wait", [1, None, pytest.param(0, marks=pytest.mark.xfail)]
)
Expand Down

0 comments on commit 1676ae7

Please sign in to comment.