def test_request_server_info(self):
        application = Application()
        with ManagedServerLoop(application) as server:
            session = ClientSession(session_id='test_request_server_info',
                                    websocket_url=ws_url(server),
                                    io_loop=server.io_loop)
            session.connect()
            assert session.connected
            assert session.document is None

            info = session.request_server_info()

            from bokeh import __version__

            assert info['version_info']['bokeh'] == __version__
            assert info['version_info']['server'] == __version__

            session.close()
            session.loop_until_closed()
            assert not session.connected
示例#2
0
    def __init__(self,
                 plot_title: str,
                 number_of_objectives: int,
                 ws_url: str = 'localhost:5006'):
        super(ScatterBokeh, self).__init__(plot_title, number_of_objectives)

        if self.number_of_objectives == 2:
            self.source = ColumnDataSource(data=dict(x=[], y=[], str=[]))
        elif self.number_of_objectives == 3:
            self.source = ColumnDataSource(data=dict(x=[], y=[], z=[], str=[]))
        else:
            raise Exception(
                'Wrong number of objectives: {0}'.format(number_of_objectives))

        self.client = ClientSession(websocket_url='ws://{0}/ws'.format(ws_url))
        self.doc = curdoc()
        self.doc.title = plot_title
        self.figure_xy = None
        self.figure_xz = None
        self.figure_yz = None

        self.__initialize()