def test_brush_indices_change(self, small_df, populated_config): ds = DataSource(small_df, None) hw = HistogramWidget(ds, 0, 0, 1.0, 400) hw.build() ds.brushed_indices = [1, 2, 3] assert hw.figure_widget.data[1].selectedpoints == ds.brushed_indices assert hw.figure_widget.data[0].visible
def test_normalize_select_false(self, small_df, populated_config): ds = DataSource(small_df, None) hw = HistogramWidget(ds, 0, 0, 1.0, 400) hw.normalize.value = False assert hw.figure_widget.data[0].histnorm == "" assert hw.figure_widget.data[1].histnorm == ""
def test_plot_invisible_with_no_data(self, small_df, populated_config): ds = DataSource(small_df) hw = HistogramWidget(ds, 0, 0, 1.0, 400) ds.brushed_indices = [] assert not hw.figure_widget.data[1].visible ds.brushed_indices = [0] assert hw.figure_widget.data[1].visible
def test_column_select(self, small_df, populated_config): ds = DataSource(small_df, None) hw = HistogramWidget(ds, 0, 0, 1.0, 400) hw.column_select.value = "b" assert list(hw.figure_widget.data[0].x) == list(small_df["b"].values)
def test_on_deselection(self, small_df, populated_config): ds = DataSource(small_df, None) ds.brushed_indices = [0] hw = HistogramWidget(ds, 0, 0, 1.0, 400) hw.on_deselection(None, None) assert len(ds.brushed_indices) == len(small_df)
def test_normal_build(self, small_df, populated_config): ds = DataSource(small_df, None) hw = HistogramWidget(ds, 0, 0, 1.0, 400) root_widget = hw.build() assert isinstance(root_widget, widgets.VBox)
def test_object_creation(self, small_df, populated_config): ds = DataSource(small_df, None) HistogramWidget(ds, 0, 0, 1.0, 400)