def test_get_selection_geometry_callback(self, df_type): bg = BaseGraph() df = initialize_df(df_type, {"a": [1, 2, 2], "b": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) assert callable(type(bg.get_box_select_callback(dashboard))) assert callable(type(bg.get_lasso_select_callback(dashboard)))
def test_box_selection_callback( self, df_type, inspect_neighbors, result, index ): nodes = initialize_df( df_type, {"vertex": [0, 1, 2, 3], "x": [0, 1, 1, 2], "y": [0, 1, 2, 0]}, ) edges = initialize_df( df_type, {"source": [1, 1, 1, 1], "target": [0, 1, 2, 3]} ) dashboard = DashBoard(dataframe=DataFrame.load_graph((nodes, edges))) bg = BaseGraph() bg.chart_type = "temp" bg.nodes = nodes bg.edges = edges bg.inspect_neighbors = inspect_neighbors self.result = None def t_function(data, edges=None, patch_update=False): self.result = data.reset_index(drop=True) bg.reload_chart = t_function dashboard._active_view = bg class evt: bounds = (1, 3, 0, 1) x_selection = (1, 3) y_selection = (0, 1) t = bg.get_box_select_callback(dashboard) t(evt.bounds, evt.x_selection, evt.y_selection) result = initialize_df(df_type, result, index) assert df_equals(self.result, result)