Пример #1
0
    def test_query_chart_by_indices(self, new_indices, result):
        bg = BaseGraph()
        bg.chart_type = "test"
        bg.x = "a"

        bg_1 = BaseGraph()
        bg_1.chart_type = "test"
        bg_1.x = "b"

        new_indices = new_indices

        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_indices(
            active_chart=bg_1,
            old_indices=[],
            new_indices=new_indices,
            datatile=None,
        )

        assert self.result.to_string() == result
Пример #2
0
    def test_query_chart_by_indices(self, df_type, new_indices, result, index):
        bg = BaseGraph()
        bg.chart_type = "test"
        bg.x = "a"

        bg_1 = BaseGraph()
        bg_1.chart_type = "test"
        bg_1.x = "b"

        new_indices = new_indices

        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_indices(
            active_chart=bg_1,
            old_indices=[],
            new_indices=new_indices,
            datatile=None,
        )
        result = initialize_df(df_type, result, index)

        assert df_equals(self.result, result)