Skip to content

Commit

Permalink
Add regression test for bug that caused histogram viewer to crash whe…
Browse files Browse the repository at this point in the history
…n removing datasets from the DataCollection
  • Loading branch information
astrofrog committed Oct 26, 2023
1 parent e973b88 commit ff12a12
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit ff12a12

Please sign in to comment.