Skip to content

Commit

Permalink
Added tests for changing limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Peter Krone committed Dec 19, 2024
1 parent a8ad0dc commit 594a89c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_qtwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ def assert_call(self):
with plot.assert_call():
mw1.parameters[0].fit.click()

# check changing of limits
mw1.parameters[0].fit.click()
mw1.parameters[0].tmin.setValue(-1)
mw1.parameters[0].tmax.setValue(1)
assert_allclose(m.limits["a"], (-1, 1), atol=1e-5)
with plot.assert_call():
mw1.parameters[0].tmin.setValue(0.5)
assert_allclose(m.limits["a"], (0.5, 1), atol=1e-5)
assert_allclose(m.values, (0.5, 0), atol=1e-5)
mw1.parameters[0].tmin.setValue(2)
assert_allclose(m.limits["a"], (0.5, 1), atol=1e-5)
assert_allclose(m.values, (0.5, 0), atol=1e-5)
mw1.parameters[0].tmin.setValue(-1)
with plot.assert_call():
mw1.parameters[0].tmax.setValue(0)
assert_allclose(m.limits["a"], (-1, 0), atol=1e-5)
assert_allclose(m.values, (0, 0), atol=1e-5)
mw1.parameters[0].tmax.setValue(-2)
assert_allclose(m.limits["a"], (-1, 0), atol=1e-5)
assert_allclose(m.values, (0, 0), atol=1e-5)


class Cost:
def visualize(self, args):
return plot(args)
Expand Down

0 comments on commit 594a89c

Please sign in to comment.