def test_add_events(self, df_type, add_interaction, reset_event, event_1, event_2): bnac = BaseNonAggregate() bnac.add_interaction = add_interaction bnac.reset_event = reset_event bnac.chart = hv.InteractiveDatashader() df = initialize_df(df_type, {"a": [1, 2, 2], "b": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) self.event_1 = None self.event_2 = None def t_func(fn): self.event_1 = fn.__name__ def t_func1(fn): self.event_2 = fn.__name__ bnac.chart.add_box_select_callback = t_func bnac.chart.add_lasso_select_callback = t_func1 bnac.add_events(dashboard) assert self.event_1 == event_1 assert self.event_2 == event_2
def test_view(self, chart, _chart): bnac = BaseNonAggregate() bnac.chart = mock.Mock(**{"view.return_value": chart}) bnac.width = 400 bnac.title = "test_title" assert str(bnac.view()) == str( chart_view(_chart, width=bnac.width, title=bnac.title))
def test_view(self, chart, _chart): bnac = BaseNonAggregate() bnac.chart = chart bnac.width = 400 bnac.title = "test_title" assert str(bnac.view()) == str( chart_view(_chart, width=bnac.width, title=bnac.title))
def test_add_reset_event(self, df_type): bnac = BaseNonAggregate() bnac.chart_type = "test" bnac.x = "a" bnac.x_range = (0, 2) bnac.y_range = (3, 5) bnac.chart = hv.InteractiveDatashader() df = initialize_df(df_type, {"a": [1, 2, 2], "b": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) dashboard._active_view = bnac def t_func1(event, fn): fn("event") bnac.add_event = t_func1 bnac.add_reset_event(dashboard) assert bnac.selected_indices is None
def test_view(self, chart, _chart): bnac = BaseNonAggregate() bnac.chart = chart bnac.width = 400 assert str(bnac.view()) == str(chart_view(_chart, width=bnac.width))