Beispiel #1
0
 def test_model_none(self):
     r = bes.server_session(None, session_id='fakesession')
     html = bs4.BeautifulSoup(r, "lxml")
     scripts = html.findAll(name='script')
     assert len(scripts) == 1
     attrs = scripts[0].attrs
     assert set(attrs), set([
         'src',
         'id'
     ])
     divid = attrs['id']
     src = "%s/autoload.js?bokeh-autoload-element=%s&bokeh-absolute-url=%s&bokeh-session-id=fakesession" % \
           ("http://localhost:5006", divid, "http://localhost:5006")
     assert attrs == { 'id' : divid,
                       'src' : src }
Beispiel #2
0
 def test_general(self, test_plot):
     r = bes.server_session(test_plot, session_id='fakesession')
     assert 'bokeh-session-id=fakesession' in r
     html = bs4.BeautifulSoup(r, "lxml")
     scripts = html.findAll(name='script')
     assert len(scripts) == 1
     attrs = scripts[0].attrs
     assert set(attrs), set([
         'src',
         'data-bokeh-doc-id',
         'data-bokeh-model-id',
         'id'
     ])
     divid = attrs['id']
     src = "%s/autoload.js?bokeh-autoload-element=%s&bokeh-absolute-url=%s&bokeh-session-id=fakesession" % \
           ("http://localhost:5006", divid, "http://localhost:5006")
     assert attrs == { 'data-bokeh-doc-id' : '',
                       'data-bokeh-model-id' : str(test_plot._id),
                       'id' : divid,
                       'src' : src }
Beispiel #3
0
 def test_resources_none(self, test_plot):
     r = bes.server_session(test_plot, session_id='fakesession', resources=None)
     assert 'resources=none' in r
Beispiel #4
0
 def test_resources_default_is_implicit(self, test_plot):
     r = bes.server_session(test_plot, session_id='fakesession', resources="default")
     assert 'resources=' not in r
Beispiel #5
0
 def test_invalid_resources_param(self, test_plot):
     with pytest.raises(ValueError):
         bes.server_session(test_plot, session_id='fakesession', resources=123)
     with pytest.raises(ValueError):
         bes.server_session(test_plot, session_id='fakesession', resources="whatever")
Beispiel #6
0
 def test_return_type(self, test_plot):
     r = bes.server_session(test_plot, session_id='fakesession')
     assert isinstance(r, str)
Beispiel #7
0
 def test_return_type(self, test_plot) -> None:
     r = bes.server_session(test_plot, session_id='fakesession')
     assert isinstance(r, str)
 def test_resources_none(self, test_plot):
     r = bes.server_session(test_plot,
                            session_id='fakesession',
                            resources=None)
     assert 'resources=none' in r
 def test_resources_default_is_implicit(self, test_plot):
     r = bes.server_session(test_plot,
                            session_id='fakesession',
                            resources="default")
     assert 'resources=' not in r
Beispiel #10
0
 def test_invalid_resources_param(self, test_plot):
     with pytest.raises(ValueError):
         bes.server_session(test_plot, session_id='fakesession', resources=123)
     with pytest.raises(ValueError):
         bes.server_session(test_plot, session_id='fakesession', resources="whatever")