def test_add_reset_event(self): bg = BaseGraph() bg.edges = None bg.chart_type = "test" bg.x = "a" bg.x_range = (0, 2) bg.y_range = (3, 5) df = cudf.DataFrame({"a": [1, 2, 2], "b": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) dashboard._active_view = "a_test" def t_func1(event, fn): fn("event") def reload_fn(nodes, edges=None, patch_update=False): pass bg.add_event = t_func1 bg.reload_chart = reload_fn bg.add_reset_event(dashboard) assert bg.x_range is None assert bg.y_range is None assert dashboard._active_view == "a_test"
def test_compute_query_dict(self, x_range, y_range, query, local_dict): bg = BaseGraph() bg.chart_type = "test" bg.x_range = x_range bg.y_range = y_range df = cudf.DataFrame({"x": [1, 2, 2], "y": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) bg.compute_query_dict(dashboard._query_str_dict, dashboard._query_local_variables_dict) assert dashboard._query_str_dict["x_test"] == query for key in local_dict: assert ( dashboard._query_local_variables_dict[key] == local_dict[key])
def test_compute_query_dict( self, df_type, x_range, y_range, query, local_dict ): bg = BaseGraph() bg.chart_type = "test" bg.box_selected_range = local_dict bg.x_range = x_range bg.y_range = y_range df = initialize_df(df_type, {"x": [1, 2, 2], "y": [3, 4, 5]}) dashboard = DashBoard(dataframe=DataFrame.from_dataframe(df)) bg.compute_query_dict( dashboard._query_str_dict, dashboard._query_local_variables_dict ) assert ( dashboard._query_str_dict[f"x_y_vertex_count_test_{bg.title}"] == query ) for key in local_dict: assert ( dashboard._query_local_variables_dict[key] == local_dict[key] )
def test_add_reset_event(self, df_type): bg = BaseGraph() bg.edges = None bg.chart_type = "test" bg.x = "a" bg.x_range = (0, 2) bg.y_range = (3, 5) bg.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 = bg def t_func1(event, fn): fn("event") def reload_fn(data, edges=None, patch_update=False): pass bg.add_event = t_func1 bg.reload_chart = reload_fn bg.add_reset_event(dashboard) assert bg.selected_indices is None