Example #1
0
    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
Example #2
0
    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 == ""
Example #3
0
    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
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 def test_object_creation(self, small_df, populated_config):
     ds = DataSource(small_df, None)
     HistogramWidget(ds, 0, 0, 1.0, 400)