Beispiel #1
0
    def test_query_chart_by_indices(self, df_type, new_indices, result, index):
        bnac = BaseNonAggregate()
        bnac.chart_type = "test"
        bnac.x = "a"

        bnac_1 = BaseNonAggregate()
        bnac_1.chart_type = "test"
        bnac_1.x = "b"

        new_indices = new_indices

        df = initialize_df(df_type, {"a": [1, 2, 3, 4], "b": [3, 4, 5, 6]})
        bnac.source = df

        self.result = None
        self.patch_update = None

        def t_func(data, patch_update):
            self.result = data
            self.patch_update = patch_update

        # creating a dummy reload chart fn as its not implemented in core
        # non aggregate chart class
        bnac.reload_chart = t_func

        bnac.query_chart_by_indices(
            active_chart=bnac_1,
            old_indices=[],
            new_indices=new_indices,
            datatile=None,
        )
        result = initialize_df(df_type, result, index)

        assert df_equals(self.result, result)
        assert self.patch_update is False
    def test_query_chart_by_indices(self, new_indices, result):
        bnac = BaseNonAggregate()
        bnac.chart_type = "test"
        bnac.x = "a"

        bnac_1 = BaseNonAggregate()
        bnac_1.chart_type = "test"
        bnac_1.x = "b"

        new_indices = new_indices

        df = cudf.DataFrame({"a": [1, 2, 3, 4], "b": [3, 4, 5, 6]})
        bnac.source = df

        self.result = None
        self.patch_update = None

        def t_func(data, patch_update):
            self.result = data
            self.patch_update = patch_update

        # creating a dummy reload chart fn as its not implemented in core
        # non aggregate chart class
        bnac.reload_chart = t_func

        bnac.query_chart_by_indices(
            active_chart=bnac_1,
            old_indices=[],
            new_indices=new_indices,
            datatile=None,
        )

        assert self.result.to_string() == result
        assert self.patch_update is False