コード例 #1
0
 def test_creation_with_ioloop(self):
     s = bcs.ClientSession(io_loop="io_loop")
     assert s.connected == False
     assert s.document is None
     assert s._connection.io_loop == "io_loop"
     assert isinstance(s.id, string_types)
     assert len(s.id) == 44
コード例 #2
0
 def test_creation_defaults(self) -> None:
     s = bcs.ClientSession()
     assert s.connected == False
     assert s.document is None
     assert s._connection._arguments is None
     assert isinstance(s.id, str)
     assert len(s.id) == 44
コード例 #3
0
 def test_creation_with_ws_url(self):
     s = bcs.ClientSession(websocket_url="wsurl")
     assert s.connected == False
     assert s.document is None
     assert s._connection.url == "wsurl"
     assert isinstance(s.id, string_types)
     assert len(s.id) == 44
コード例 #4
0
 def test_request_server_info(self,
                              mock_request_server_info: MagicMock) -> None:
     s = bcs.ClientSession()
     s.request_server_info()
     assert mock_request_server_info.call_count == 1
     assert mock_request_server_info.call_args[0] == ()
     assert mock_request_server_info.call_args[1] == {}
コード例 #5
0
    def test_loop_until_closed_suppress_warnings(self, mock_loop_until_closed, mock_warn):
        s = bcs.ClientSession()
        s.loop_until_closed(True)
        assert mock_loop_until_closed.call_count == 1
        assert mock_loop_until_closed.call_args[0] == ()
        assert mock_loop_until_closed.call_args[1] == {}

        assert mock_warn.call_count == 0
コード例 #6
0
 def test_creation_with_ioloop(self) -> None:
     s = bcs.ClientSession(io_loop="io_loop")
     assert s.connected is False
     assert s.document is None
     assert s._connection._arguments is None
     assert s._connection.io_loop == "io_loop"
     assert isinstance(s.id, str)
     assert len(s.id) == 44
コード例 #7
0
 def test_creation_with_ws_url(self) -> None:
     s = bcs.ClientSession(websocket_url="wsurl")
     assert s.connected is False
     assert s.document is None
     assert s._connection._arguments is None
     assert s._connection.url == "wsurl"
     assert isinstance(s.id, str)
     assert len(s.id) == 44
コード例 #8
0
    def test_loop_until_closed(self, mock_loop_until_closed, mock_warn):
        s = bcs.ClientSession()
        s.loop_until_closed()
        assert mock_loop_until_closed.call_count == 1
        assert mock_loop_until_closed.call_args[0] == ()
        assert mock_loop_until_closed.call_args[1] == {}

        assert mock_warn.call_count == 1
        assert mock_warn.call_args[0] == (bcs._BOKEH_CLIENT_APP_WARNING_FULL, )
        assert mock_warn.call_args[1] == {}
コード例 #9
0
 def test_context_manager(self, mock_close) -> None:
     with bcs.ClientSession() as session:
         assert isinstance(session, bcs.ClientSession)
     assert mock_close.call_count == 1
     assert mock_close.call_args[0] == ("closed", )
     assert mock_close.call_args[1] == {}
コード例 #10
0
 def test_close(self, mock_close) -> None:
     s = bcs.ClientSession()
     s.close()
     assert mock_close.call_count == 1
     assert mock_close.call_args[0] == ("closed", )
     assert mock_close.call_args[1] == {}
コード例 #11
0
 def test_connect(self, mock_connect) -> None:
     s = bcs.ClientSession()
     s.connect()
     assert mock_connect.call_count == 1
     assert mock_connect.call_args[0] == ()
     assert mock_connect.call_args[1] == {}
コード例 #12
0
 def test_creation_with_arguments(self) -> None:
     s = bcs.ClientSession(arguments="args")
     assert s.connected == False
     assert s.document is None
     assert s._connection._arguments == "args"
     assert len(s.id) == 44
コード例 #13
0
 def test_creation_with_session_id(self) -> None:
     s = bcs.ClientSession("sid")
     assert s.connected == False
     assert s.document is None
     assert s._connection._arguments is None
     assert s.id == "sid"
コード例 #14
0
 def test_force_roundtrip(self, mock_force_roundtrip) -> None:
     s = bcs.ClientSession()
     s.force_roundtrip()
     assert mock_force_roundtrip.call_count == 1
     assert mock_force_roundtrip.call_args[0] == ()
     assert mock_force_roundtrip.call_args[1] == {}
コード例 #15
0
 def test_close_with_why(self, mock_close) -> None:
     s = bcs.ClientSession()
     s.close("foo")
     assert mock_close.call_count == 1
     assert mock_close.call_args[0] == ("foo", )
     assert mock_close.call_args[1] == {}
コード例 #16
0
 def test_creation_defaults(self):
     s = bcs.ClientSession()
     assert s.connected == False
     assert s.document is None
     assert isinstance(s.id, string_types)
     assert len(s.id) == 44