Skip to content

Commit

Permalink
Add test similar to lcviz
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Mar 11, 2024
1 parent 0655d4a commit f216cca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions jdaviz/configs/specviz/tests/test_viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,23 @@ def test_spectrum_viewer_axis_labels(specviz_helper, input_unit, y_axis_label):
label = specviz_helper.app.get_viewer_by_id('specviz-0').figure.axes[1].label

assert (y_axis_label in label)


def test_reset_limits(specviz_helper, spectrum1d):
specviz_helper.load_data(spectrum1d)
sv = specviz_helper.app.get_viewer("spectrum-viewer")

orig_xlims = (sv.state.x_min, sv.state.x_max)
orig_ylims = (sv.state.y_min, sv.state.y_max)
# set xmin and ymin to midpoints
new_xmin = (sv.state.x_min + sv.state.x_max) * 0.5
new_ymin = (sv.state.y_min + sv.state.y_max) * 0.5
sv.state.x_min = new_xmin
sv.state.y_min = new_ymin

sv.state._reset_x_limits()
assert sv.state.x_min == orig_xlims[0]
assert sv.state.y_min == new_ymin

sv.state._reset_y_limits()
assert sv.state.y_min == orig_ylims[0]

0 comments on commit f216cca

Please sign in to comment.