Beispiel #1
0
 def test_widget_delete(self):
     data = {"a": np.arange(0, 50)}
     widget = PerspectiveWidget(data)
     mocked_post = partial(mock_post, assert_msg={"cmd": "delete"})
     widget.post = MethodType(mocked_post, widget)
     widget.delete()
     assert widget.table is None
Beispiel #2
0
    def test_widget_delete_with_view(self):
        data = {"a": np.arange(0, 50)}
        widget = PerspectiveWidget(data)

        # create a view on the manager
        table_name, table = list(widget.manager._tables.items())[0]
        make_view_message = {
            "id": 1,
            "table_name": table_name,
            "view_name": "view1",
            "cmd": "view",
            "config": {
                "group_by": ["a"]
            }
        }
        widget.manager._process(make_view_message, lambda x: True)

        assert len(widget.manager._views) == 1

        mocked_post = partial(mock_post, assert_msg={"cmd": "delete"})

        widget.post = MethodType(mocked_post, widget)
        widget.delete()

        assert widget.table is None
Beispiel #3
0
 def test_widget_delete_view(self):
     data = {"a": np.arange(0, 50)}
     table = Table(data)
     view = table.view()
     widget = PerspectiveWidget(view)
     mocked_post = partial(mock_post, assert_msg={"cmd": "delete"})
     widget.post = MethodType(mocked_post, widget)
     widget.delete()
     assert widget._view is None
     assert widget.table is None
Beispiel #4
0
 def test_widget_delete_client(self):
     data = {"a": np.arange(0, 50)}
     widget = PerspectiveWidget(data, client=True)
     mocked_post = partial(mock_post, assert_msg={"cmd": "delete"})
     widget.delete()
     widget.post = MethodType(mocked_post, widget)