예제 #1
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_doesnt_duplicate_if_already_there(m):
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == [p]
    bis.show(p)
    assert curstate().document.roots == [p]
예제 #2
0
def test_show_doesnt_duplicate_if_already_there(m):
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == [p]
    bis.show(p)
    assert curstate().document.roots == [p]
예제 #3
0
def test_show_with_default_args(mock__show_with_state):
    curstate().reset()
    default_kwargs = dict(browser=None, new="tab", notebook_handle=False)
    p = Plot()
    bis.show(p, **default_kwargs)
    assert mock__show_with_state.call_count == 1
    assert mock__show_with_state.call_args[0] == (p, curstate(), None, "tab")
    assert mock__show_with_state.call_args[1] == {'notebook_handle': False}
    assert p in curdoc().roots
예제 #4
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_with_explicit_args(mock__show_with_state):
    curstate().reset()
    kwargs = dict(browser="browser", new="new", notebook_handle=True)
    p = Plot()
    bis.show(p, **kwargs)
    assert mock__show_with_state.call_count == 1
    assert mock__show_with_state.call_args[0] == (p, curstate(), "browser", "new")
    assert mock__show_with_state.call_args[1] == {'notebook_handle': True}
    assert p in curdoc().roots
예제 #5
0
def test_show_doesn_not_adds_obj_to_curdoc(m) -> None:
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == []
예제 #6
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_with_default_args(mock__show_with_state):
    curstate().reset()
    default_kwargs = dict(browser=None, new="tab", notebook_handle=False)
    p = Plot()
    bis.show(p, **default_kwargs)
    assert mock__show_with_state.call_count == 1
    assert mock__show_with_state.call_args[0] == (p, curstate(), None, "tab")
    assert mock__show_with_state.call_args[1] == {'notebook_handle': False}
    assert p in curdoc().roots
예제 #7
0
def test_show_with_explicit_args(mock__show_with_state):
    curstate().reset()
    kwargs = dict(browser="browser", new="new", notebook_handle=True)
    p = Plot()
    bis.show(p, **kwargs)
    assert mock__show_with_state.call_count == 1
    assert mock__show_with_state.call_args[0] == (p, curstate(), "browser", "new")
    assert mock__show_with_state.call_args[1] == {'notebook_handle': True}
    assert p in curdoc().roots
예제 #8
0
def test_show_doesn_not_adds_obj_to_curdoc(m):
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert curstate().document.roots == []
예제 #9
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_with_app(mock_run_notebook_hook):
    curstate().reset()
    app = Application()
    output_notebook()
    bis.show(app, notebook_url="baz")
    assert curstate().notebook_type == "jupyter"
    assert mock_run_notebook_hook.call_count == 1
    assert mock_run_notebook_hook.call_args[0][0] == curstate().notebook_type
    assert mock_run_notebook_hook.call_args[0][1:] == ("app", app, curstate(), "baz")
    assert mock_run_notebook_hook.call_args[1] == {}
예제 #10
0
def test_show_with_app(mock_run_notebook_hook):
    curstate().reset()
    app = Application()
    output_notebook()
    bis.show(app, notebook_url="baz")
    assert curstate().notebook_type == "jupyter"
    assert mock_run_notebook_hook.call_count == 1
    assert mock_run_notebook_hook.call_args[0][0] == curstate().notebook_type
    assert mock_run_notebook_hook.call_args[0][1:] == ("app", app, curstate(), "baz")
    assert mock_run_notebook_hook.call_args[1] == {}
예제 #11
0
def test_show_adds_obj_to_document_if_not_already_there(m):
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert p in curstate().document.roots
예제 #12
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_with_bad_object(obj):
    with pytest.raises(ValueError):
        bis.show(obj)
예제 #13
0
파일: test_showing.py 프로젝트: gully/bokeh
def test_show_adds_obj_to_document_if_not_already_there(m):
    curstate().reset()
    assert curstate().document.roots == []
    p = Plot()
    bis.show(p)
    assert p in curstate().document.roots
예제 #14
0
def test_show_with_bad_object(obj):
    with pytest.raises(ValueError):
        bis.show(obj)
예제 #15
0
def main_vis(fig):
    show(fig)