def test_query_chart_by_range(self): bg = BaseGraph() bg.chart_type = "test" bg.x = "a" bg_1 = BaseGraph() bg_1.chart_type = "test" bg_1.x = "b" query_tuple = (4, 5) df = cudf.DataFrame({"a": [1, 2, 3, 4], "b": [3, 4, 5, 6]}) bg.nodes = df self.result = None def t_func(data): self.result = data # creating a dummy reload chart fn as its not implemented in core # non aggregate chart class bg.reload_chart = t_func bg.query_chart_by_range(active_chart=bg_1, query_tuple=query_tuple, datatile=None) assert self.result.to_string() == " a b\n1 2 4\n2 3 5"
def test_query_chart_by_range(self, df_type): bg = BaseGraph() bg.chart_type = "test" bg.x = "a" bg_1 = BaseGraph() bg_1.chart_type = "test" bg_1.x = "b" query_tuple = (4, 5) df = initialize_df(df_type, {"a": [1, 2, 3, 4], "b": [3, 4, 5, 6]}) bg.nodes = df self.result = None def t_func(data): self.result = data # creating a dummy reload chart fn as its not implemented in core # non aggregate chart class bg.reload_chart = t_func bg.query_chart_by_range( active_chart=bg_1, query_tuple=query_tuple, datatile=None ) assert df_equals( self.result, initialize_df(df_type, {"a": [2, 3], "b": [4, 5]}, [1, 2]), )