Skip to content

Commit

Permalink
Merge pull request #407 from astrofrog/test-histogram-data-remove
Browse files Browse the repository at this point in the history
Add regression test for bug that caused histogram viewer to crash when removing datasets
  • Loading branch information
astrofrog authored Oct 26, 2023
2 parents ec74442 + 04b4844 commit 0a1211a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion glue_jupyter/bqplot/histogram/tests/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_non_hex_colors(app, dataxyz):
dataxyz.subsets[0].style.color = 'purple'


def test_remove(app, dataxz, dataxyz):
def test_remove_from_viewer(app, dataxz, dataxyz):
s = app.histogram1d(data=dataxyz)
s.add_data(dataxz)
app.data_collection.new_subset_group(subset_state=dataxz.id['x'] > 1, label='test')
Expand All @@ -28,6 +28,20 @@ def test_remove(app, dataxz, dataxyz):
assert len(s.figure.marks) == 0


def test_remove_from_data_collection(app, dataxz, dataxyz):
s = app.histogram1d(data=dataxyz)
s.add_data(dataxz)
app.data_collection.new_subset_group(subset_state=dataxz.id['x'] > 1, label='test')
assert len(s.figure.marks) == 4
s.state.hist_n_bin = 30
app.data_collection.remove(dataxyz)
assert len(s.figure.marks) == 2
s.state.hist_n_bin = 20
app.data_collection.remove(dataxz)
assert len(s.figure.marks) == 0
s.state.hist_n_bin = 10


def test_redraw_empty_subset(app, dataxz):
s = app.histogram1d(data=dataxz)
s.add_data(dataxz)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python_requires = >=3.8
setup_requires =
setuptools_scm
install_requires =
glue-core>=1.7.0
glue-core>=1.14.1
glue-vispy-viewers>=1.0
notebook>=4.0
ipympl>=0.3.0
Expand Down

0 comments on commit 0a1211a

Please sign in to comment.