def test_add_reset_event(self, dashboard): bl = BaseLine(x="key", y="val") bl.chart = hv.InteractiveDatashader() self.result = None def test_func(event, callback): self.result = callback bl.add_event = test_func # test the following function behavior bl.add_reset_event(dashboard) assert bl.selected_indices is None
def test_add_events(self, dashboard, event, result): bl = BaseLine(x="key", y="val") bl.chart = hv.InteractiveDatashader() self.result = None def test_func(cls): self.result = "func_Called" bl.add_reset_event = test_func bl.reset_event = event # test the following function behavior bl.add_events(dashboard) assert self.result == result
def test_compute_query_dict(self, dashboard, x_range, y_range, query, local_dict): bl = BaseLine(x="x", y="y", title="custom_title") bl.chart_type = "non_aggregate_line" bl.box_selected_range = local_dict bl.chart = hv.InteractiveDatashader() bl.x_range = x_range bl.y_range = y_range dashboard.add_charts([bl]) # test the following function behavior bl.compute_query_dict( dashboard._query_str_dict, dashboard._query_local_variables_dict, ) assert ( dashboard._query_str_dict["x_y_non_aggregate_line_custom_title"] == query) for key in local_dict: assert ( dashboard._query_local_variables_dict[key] == local_dict[key])
def test_view(self, chart, _chart): bl = BaseLine(x="test_x", y="test_y") bl.chart = chart bl.width = 400 assert str(bl.view()) == str(chart_view(_chart, width=bl.width))
def test_view(self, chart, _chart): bl = BaseLine(x="test_x", y="test_y") bl.chart = mock.Mock(**{"view.return_value": chart}) bl.width = 400 assert str(bl.view()) == str(chart_view(_chart, width=bl.width))