# API Definition #----------------------------------------------------------------------------- api = { PUBLIC: ( ( 'show', (1, 0, 0) ), ), INTERNAL: ( ) } Test_api = verify_api(bis, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- @patch('bokeh.io.showing._show_with_state') 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)
( 'CodeRunner', (1,0,0) ), ( 'CodeRunner.error.fget', (1,0,0) ), ( 'CodeRunner.error_detail.fget', (1,0,0) ), ( 'CodeRunner.failed.fget', (1,0,0) ), ( 'CodeRunner.path.fget', (1,0,0) ), ( 'CodeRunner.source.fget', (1,0,0) ), ( 'CodeRunner.new_module', (1,0,0) ), ( 'CodeRunner.run', (1,0,0) ), ) } Test_api = verify_api(bahc, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Private API
( 'HSL', (1, 0, 0) ), ( 'HSL.copy', (1, 0, 0) ), ( 'HSL.from_hsl', (1, 0, 0) ), ( 'HSL.from_rgb', (1, 0, 0) ), ( 'HSL.to_css', (1, 0, 0) ), ( 'HSL.to_hsl', (1, 0, 0) ), ( 'HSL.to_rgb', (1, 0, 0) ), ), DEV: ( ) } Test_api = verify_api(bch, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_HSL(object): def test_init(self): c = bch.HSL(10, 0.2, 0.3) assert c assert c.a == 1.0
GENERAL: ( ( 'FunctionHandler', (1,0,0) ), ( 'FunctionHandler.safe_to_fork.fget', (1,0,0) ), ( 'FunctionHandler.modify_document', (1,0,0) ), ), DEV: ( ) } Test_api = verify_api(bahf, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class AnotherModelInTestFunction(Model): bar = Int(1) class SomeModelInTestFunction(Model): foo = Int(2) child = Instance(Model) #----------------------------------------------------------------------------- # General API #-----------------------------------------------------------------------------
# API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ), DEV: ( ( 'bundle_for_objs_and_resources', (1,0,0) ), ) } Test_api = verify_api(beb, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure() test_plot.circle([1, 2], [2, 3]) return test_plot @pytest.fixture def test_glplot(): from bokeh.plotting import figure
( 'dodge', (1, 0, 0) ), ( 'factor_cmap', (1, 0, 0) ), ( 'jitter', (1, 0, 0) ), ( 'linear_cmap', (1, 0, 0) ), ( 'log_cmap', (1, 0, 0) ), ( 'stack', (1, 0, 0) ), ( 'transform', (1, 0, 0) ), ), INTERNAL: ( ) } Test_api = verify_api(bt, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- ALL = ( 'dodge', 'factor_cmap', 'jitter', 'linear_cmap', 'log_cmap', 'stack', 'transform', )
( 'RGB', (1, 0, 0) ), ( 'RGB.copy', (1, 0, 0) ), ( 'RGB.from_hsl', (1, 0, 0) ), ( 'RGB.from_rgb', (1, 0, 0) ), ( 'RGB.to_css', (1, 0, 0) ), ( 'RGB.to_hex', (1, 0, 0) ), ( 'RGB.to_hsl', (1, 0, 0) ), ( 'RGB.to_rgb', (1, 0, 0) ), ), INTERNAL: ( ) } Test_api = verify_api(bcr, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- class Test_RGB(object): def test_init(self): c = bcr.RGB(10, 20, 30) assert c assert c.a == 1.0
# External imports # Bokeh imports from bokeh.document import Document # Module under test import bokeh.embed.bundle as beb #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = {GENERAL: (), DEV: (('bundle_for_objs_and_resources', (1, 0, 0)), )} Test_api = verify_api(beb, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure() test_plot.circle([1, 2], [2, 3]) return test_plot @pytest.fixture
import bokeh.util.hex as buh #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ('axial_to_cartesian', (1, 0, 0)), ('cartesian_to_axial', (1, 0, 0)), ('hexbin', (1, 0, 0)), ), DEV: () } Test_api = verify_api(buh, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- np.random.seed(0) n = 500 x = 2 + np.random.standard_normal(n) y = 2 + np.random.standard_normal(n) #----------------------------------------------------------------------------- # General API #-----------------------------------------------------------------------------
# API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ( 'NotebookHandler', (1,0,0) ), ), DEV: ( ) } Test_api = verify_api(bahn, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- def with_script_contents(contents, func): def with_file_object(f): nbsource = nbformat.writes(contents) f.write(nbsource.encode("UTF-8")) f.flush() func(f.name) with_temporary_file(with_file_object) #----------------------------------------------------------------------------- # General API
api = { PUBLIC: ( ('RGB', (1, 0, 0)), ('RGB.copy', (1, 0, 0)), ('RGB.from_hsl', (1, 0, 0)), ('RGB.from_rgb', (1, 0, 0)), ('RGB.to_css', (1, 0, 0)), ('RGB.to_hex', (1, 0, 0)), ('RGB.to_hsl', (1, 0, 0)), ('RGB.to_rgb', (1, 0, 0)), ), INTERNAL: () } Test_api = verify_api(bcr, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- class Test_RGB(object): def test_init(self): c = bcr.RGB(10, 20, 30) assert c assert c.a == 1.0
api = { GENERAL: ( ( 'output_file', (1, 0, 0) ), ( 'output_notebook', (1, 0, 0) ), ( 'reset_output', (1, 0, 0) ), ), DEV: ( ) } Test_api = verify_api(bio, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_output_file(object): @patch('bokeh.io.state.State.output_file') def test_no_args(self, mock_output_file): default_kwargs = dict(title="Bokeh Plot", mode="cdn", root_dir=None) bio.output_file("foo.html")
import nbformat # Bokeh imports from bokeh.document import Document from bokeh.util.testing import with_temporary_file # Module under test import bokeh.application.handlers.notebook as bahn #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = {GENERAL: (('NotebookHandler', (1, 0, 0)), ), DEV: ()} Test_api = verify_api(bahn, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- def with_script_contents(contents, func): def with_file_object(f): nbsource = nbformat.writes(contents) f.write(nbsource.encode("UTF-8")) f.flush() func(f.name) with_temporary_file(with_file_object)
( 'Handler.modify_document', (1,0,0) ), ( 'Handler.on_server_loaded', (1,0,0) ), ( 'Handler.on_server_unloaded', (1,0,0) ), ( 'Handler.on_session_created', (1,0,0) ), ( 'Handler.on_session_destroyed', (1,0,0) ), ( 'Handler.static_path', (1,0,0) ), ( 'Handler.url_path', (1,0,0) ), ), DEV: ( ) } Test_api = verify_api(bahh, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_Handler(object): def test_create(self): h = bahh.Handler() assert h.failed == False assert h.url_path() is None
( 'ServerContext.add_timeout_callback', (1,0,0) ), ( 'ServerContext.remove_next_tick_callback', (1,0,0) ), ( 'ServerContext.remove_periodic_callback', (1,0,0) ), ( 'ServerContext.remove_timeout_callback', (1,0,0) ), ( 'SessionContext', (1,0,0) ), ( 'SessionContext.destroyed.fget', (1,0,0) ), ( 'SessionContext.id.fget', (1,0,0) ), ( 'SessionContext.server_context.fget', (1,0,0) ), ( 'SessionContext.with_locked_document', (1,0,0) ), ) } Test_api = verify_api(baa, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class AnotherModelInTestApplication(Model): baar = Int(1) class SomeModelInTestApplication(Model): foo = Int(2) child = Instance(Model) #----------------------------------------------------------------------------- # General API #-----------------------------------------------------------------------------
('DirectoryHandler', (1, 0, 0)), ('DirectoryHandler.error.fget', (1, 0, 0)), ('DirectoryHandler.error_detail.fget', (1, 0, 0)), ('DirectoryHandler.failed.fget', (1, 0, 0)), ('DirectoryHandler.safe_to_fork.fget', (1, 0, 0)), ('DirectoryHandler.modify_document', (1, 0, 0)), ('DirectoryHandler.on_server_loaded', (1, 0, 0)), ('DirectoryHandler.on_server_unloaded', (1, 0, 0)), ('DirectoryHandler.on_session_created', (1, 0, 0)), ('DirectoryHandler.on_session_destroyed', (1, 0, 0)), ('DirectoryHandler.url_path', (1, 0, 0)), ), DEV: () } Test_api = verify_api(bahd, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- script_adds_two_roots_template = """ from bokeh.io import curdoc from bokeh.model import Model from bokeh.core.properties import Int, Instance class %s(Model): bar = Int(1) class %s(Model): foo = Int(2)
( 'DirectoryHandler.safe_to_fork.fget', (1,0,0) ), ( 'DirectoryHandler.modify_document', (1,0,0) ), ( 'DirectoryHandler.on_server_loaded', (1,0,0) ), ( 'DirectoryHandler.on_server_unloaded', (1,0,0) ), ( 'DirectoryHandler.on_session_created', (1,0,0) ), ( 'DirectoryHandler.on_session_destroyed', (1,0,0) ), ( 'DirectoryHandler.url_path', (1,0,0) ), ), DEV: ( ) } Test_api = verify_api(bahd, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- script_adds_two_roots_template = """ from bokeh.io import curdoc from bokeh.model import Model from bokeh.core.properties import Int, Instance class %s(Model): bar = Int(1) class %s(Model): foo = Int(2)
( 'export_png', (1, 0, 0) ), ( 'export_svgs', (1, 0, 0) ), ), DEV: ( ( 'get_screenshot_as_png', (1, 0, 0) ), ( 'get_svgs', (1, 0, 0) ), ( 'save_layout_html', (1, 0, 0) ), ( 'wait_until_render_complete', (1, 0, 0) ), ), } Test_api = verify_api(bie, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- @pytest.mark.unit @pytest.mark.selenium
# External imports # Bokeh imports from bokeh.document import Document from bokeh.util.testing import with_file_contents # Module under test import bokeh.application.handlers.script as bahs #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = {GENERAL: (('ScriptHandler', (1, 0, 0)), ), DEV: ()} Test_api = verify_api(bahs, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_ScriptHandler(object): def test_runner_uses_source_from_filename(self): doc = Document() source = "# Test contents for script" result = {}
# API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ( 'ScriptHandler', (1,0,0) ), ), DEV: ( ) } Test_api = verify_api(bahs, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_ScriptHandler(object): def test_runner_uses_source_from_filename(self): doc = Document() source = "# Test contents for script" result = {}
#----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { PUBLIC: (), INTERNAL: ( ('WebSocketClientConnectionWrapper', (1, 0, 0)), ('WebSocketClientConnectionWrapper.write_message', (1, 0, 0)), ('WebSocketClientConnectionWrapper.close', (1, 0, 0)), ('WebSocketClientConnectionWrapper.read_message', (1, 0, 0)), ) } Test_api = verify_api(bcw, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- class Test_WebSocketClientConnectionWrapper(object):
api = { PUBLIC: ( ), INTERNAL: ( ( 'ColorGroup' , (1, 0, 0) ), ( 'NamedColor' , (1, 0, 0) ), ( 'NamedColor.to_css' , (1, 0, 0) ), ) } Test_api = verify_api(bcu, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class _TestGroup(bcu.ColorGroup): _colors = ("Red", "Green", "Blue") #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API
api = { PUBLIC: ( ( 'autoload_static', (1,0,0) ), ( 'components', (1,0,0) ), ( 'file_html', (1,0,0) ), ), INTERNAL: ( ) } Test_api = verify_api(bes, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class SomeModelInTestObjects(Model): child = Instance(Model) def stable_id(): return 'ID' @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure()
( 'CommsHandle.comms.fget', (1, 0, 0) ), ( 'CommsHandle.doc.fget', (1, 0, 0) ), ( 'destroy_server', (1, 0, 0) ), ( 'get_comms', (1, 0, 0) ), ( 'install_jupyter_hooks', (1, 0, 0) ), ( 'load_notebook', (1, 0, 0) ), ( 'publish_display_data', (1, 0, 0) ), ( 'show_app', (1, 0, 0) ), ( 'show_doc', (1, 0, 0) ), ) } Test_api = verify_api(binb, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- def test_install_notebook_hook(): binb.install_notebook_hook("foo", "load", "doc", "app") assert binb._HOOKS["foo"]['load'] == "load" assert binb._HOOKS["foo"]['doc'] == "doc" assert binb._HOOKS["foo"]['app'] == "app" with pytest.raises(RuntimeError):
api = { PUBLIC: ( ), INTERNAL: ( ( 'default_filename', (1, 0, 0) ), ( 'detect_current_filename', (1, 0, 0) ), ( 'temp_filename', (1, 0, 0) ), ) } Test_api = verify_api(biu, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- def test_detect_current_filename(): assert biu.detect_current_filename().endswith("py.test")
api = { PUBLIC: ( ), INTERNAL: ( ( 'WebSocketClientConnectionWrapper', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.write_message', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.close', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.read_message', (1, 0, 0) ), ) } test_public_api, test_internal_api, test_all_declared, test_all_tested = verify_api(bcw, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- class Test_WebSocketClientConnectionWrapper(object):
('ClientConnection', (1, 0, 0)), ('ClientConnection.connected.fget', (1, 0, 0)), ('ClientConnection.io_loop.fget', (1, 0, 0)), ('ClientConnection.url.fget', (1, 0, 0)), ('ClientConnection.connect', (1, 0, 0)), ('ClientConnection.close', (1, 0, 0)), ('ClientConnection.force_roundtrip', (1, 0, 0)), ('ClientConnection.loop_until_closed', (1, 0, 0)), ('ClientConnection.pull_doc', (1, 0, 0)), ('ClientConnection.push_doc', (1, 0, 0)), ('ClientConnection.request_server_info', (1, 0, 0)), ('ClientConnection.send_message', (1, 0, 0)), ) } Test_api = verify_api(bcc, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- class Test_ClientConnection(object):
api = { PUBLIC: ( ('RGB', (1, 0, 0)), ('RGB.copy', (1, 0, 0)), ('RGB.from_hsl', (1, 0, 0)), ('RGB.from_rgb', (1, 0, 0)), ('RGB.to_css', (1, 0, 0)), ('RGB.to_hex', (1, 0, 0)), ('RGB.to_hsl', (1, 0, 0)), ('RGB.to_rgb', (1, 0, 0)), ), INTERNAL: () } test_public_api, test_internal_api, test_all_declared, test_all_tested = verify_api( bcr, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- class Test_RGB(object): def test_init(self): c = bcr.RGB(10, 20, 30) assert c assert c.a == 1.0
# Module under test import bokeh.embed.server as bes #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { PUBLIC: ( ('server_document', (1, 0, 0)), ('server_session', (1, 0, 0)), ), INTERNAL: (('server_html_page_for_session', (1, 0, 0)), ) } Test_api = verify_api(bes, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure() test_plot.circle([1, 2], [2, 3]) return test_plot #-----------------------------------------------------------------------------
( 'check_models_or_docs', (1,0,0) ), ( 'check_one_model_or_doc', (1,0,0) ), ( 'div_for_render_item', (1,0,0) ), ( 'find_existing_docs', (1,0,0) ), ( 'html_page_for_render_items', (1,0,0) ), ( 'script_for_render_items', (1,0,0) ), ( 'standalone_docs_json_and_render_items', (1,0,0) ), ( 'wrap_in_onload', (1,0,0) ), ( 'wrap_in_safely', (1,0,0) ), ( 'wrap_in_script_tag', (1,0,0) ), ) } Test_api = verify_api(beu, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- class Test_FromCurdoc(object):
( 'ClientConnection.io_loop.fget', (1, 0, 0) ), ( 'ClientConnection.url.fget', (1, 0, 0) ), ( 'ClientConnection.connect', (1, 0, 0) ), ( 'ClientConnection.close', (1, 0, 0) ), ( 'ClientConnection.force_roundtrip', (1, 0, 0) ), ( 'ClientConnection.loop_until_closed', (1, 0, 0) ), ( 'ClientConnection.pull_doc', (1, 0, 0) ), ( 'ClientConnection.push_doc', (1, 0, 0) ), ( 'ClientConnection.request_server_info', (1, 0, 0) ), ( 'ClientConnection.send_message', (1, 0, 0) ), ) } Test_api = verify_api(bcc, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- class Test_ClientConnection(object):
('ServerContext.sessions.fget', (1, 0, 0)), ('ServerContext.add_next_tick_callback', (1, 0, 0)), ('ServerContext.add_periodic_callback', (1, 0, 0)), ('ServerContext.add_timeout_callback', (1, 0, 0)), ('ServerContext.remove_next_tick_callback', (1, 0, 0)), ('ServerContext.remove_periodic_callback', (1, 0, 0)), ('ServerContext.remove_timeout_callback', (1, 0, 0)), ('SessionContext', (1, 0, 0)), ('SessionContext.destroyed.fget', (1, 0, 0)), ('SessionContext.id.fget', (1, 0, 0)), ('SessionContext.server_context.fget', (1, 0, 0)), ('SessionContext.with_locked_document', (1, 0, 0)), ) } Test_api = verify_api(baa, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- # needed for caplog tests to function basicConfig() class AnotherModelInTestApplication(Model): baar = Int(1) class SomeModelInTestApplication(Model): foo = Int(2)
# External imports # Bokeh imports from bokeh.core.templates import DOC_NB_JS, PLOT_DIV from bokeh.core.json_encoder import serialize_json # Module under test import bokeh.embed.notebook as ben #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = {PUBLIC: (), INTERNAL: (('notebook_content', (1, 0, 0)), )} Test_api = verify_api(ben, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure() test_plot.circle([1, 2], [2, 3]) return test_plot #-----------------------------------------------------------------------------
#----------------------------------------------------------------------------- api = { PUBLIC: ( ('HSL', (1, 0, 0)), ('HSL.copy', (1, 0, 0)), ('HSL.from_hsl', (1, 0, 0)), ('HSL.from_rgb', (1, 0, 0)), ('HSL.to_css', (1, 0, 0)), ('HSL.to_hsl', (1, 0, 0)), ('HSL.to_rgb', (1, 0, 0)), ), INTERNAL: () } Test_api = verify_api(bch, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- class Test_HSL(object): def test_init(self): c = bch.HSL(10, 0.2, 0.3) assert c assert c.a == 1.0
( 'CONNECTED_BEFORE_ACK', (1, 0, 0) ), ( 'CONNECTED_BEFORE_ACK.run', (1, 0, 0) ), ( 'CONNECTED_AFTER_ACK', (1, 0, 0) ), ( 'CONNECTED_AFTER_ACK.run', (1, 0, 0) ), ( 'DISCONNECTED', (1, 0, 0) ), ( 'DISCONNECTED.run', (1, 0, 0) ), ( 'WAITING_FOR_REPLY', (1, 0, 0) ), ( 'WAITING_FOR_REPLY.reply.fget', (1, 0, 0) ), ( 'WAITING_FOR_REPLY.reqid.fget', (1, 0, 0) ), ( 'WAITING_FOR_REPLY.run', (1, 0, 0) ), ) } Test_api = verify_api(bcs, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class MockConnection(object): def __init__(self, to_pop=None): self._to_pop = to_pop def _connect_async(self): raise gen.Return("_connect_async") def _wait_for_ack(self): raise gen.Return("_wait_for_ack") def _handle_messages(self): raise gen.Return("_handle_messages") def _transition(self, arg): raise gen.Return(("_transition", arg)) def _transition_to_disconnected(self): raise gen.Return("_transition_to_disconnected") def _next(self): raise gen.Return("_next")
import bokeh.io.util as biu #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { PUBLIC: (), INTERNAL: ( ('default_filename', (1, 0, 0)), ('detect_current_filename', (1, 0, 0)), ('temp_filename', (1, 0, 0)), ) } Test_api = verify_api(biu, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Internal API #----------------------------------------------------------------------------- def test_detect_current_filename():
('ClientSession.connected.fget', (1, 0, 0)), ('ClientSession.document.fget', (1, 0, 0)), ('ClientSession.id.fget', (1, 0, 0)), ('ClientSession.connect', (1, 0, 0)), ('ClientSession.close', (1, 0, 0)), ('ClientSession.force_roundtrip', (1, 0, 0)), ('ClientSession.loop_until_closed', (1, 0, 0)), ('ClientSession.pull', (1, 0, 0)), ('ClientSession.push', (1, 0, 0)), ('ClientSession.request_server_info', (1, 0, 0)), ('ClientSession.show', (1, 0, 0)), ), DEV: () } Test_api = verify_api(bcs, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- def test_module_docstring_warning(): assert bcs._BOKEH_CLIENT_APP_WARNING_BODY in bcs.__doc__ def test_DEFAULT_SESSION_ID():
from bokeh.application.application import Application from bokeh.io.doc import curdoc from bokeh.io.output import output_notebook from bokeh.io.state import curstate, State from bokeh.models.plots import Plot # Module under test import bokeh.io.showing as bis #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = {PUBLIC: (('show', (1, 0, 0)), ), INTERNAL: ()} Test_api = verify_api(bis, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Public API #----------------------------------------------------------------------------- @patch('bokeh.io.showing._show_with_state') def test_show_with_default_args(mock__show_with_state): curstate().reset() default_kwargs = dict(browser=None, new="tab", notebook_handle=False) p = Plot()
( 'CommsHandle.comms.fget', (1, 0, 0) ), ( 'CommsHandle.doc.fget', (1, 0, 0) ), ( 'destroy_server', (1, 0, 0) ), ( 'get_comms', (1, 0, 0) ), ( 'install_jupyter_hooks', (1, 0, 0) ), ( 'load_notebook', (1, 0, 0) ), ( 'publish_display_data', (1, 0, 0) ), ( 'show_app', (1, 0, 0) ), ( 'show_doc', (1, 0, 0) ), ) } Test_api = verify_api(binb, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- def test_install_notebook_hook(): binb.install_notebook_hook("foo", "load", "doc", "app") assert binb._HOOKS["foo"]['load'] == "load" assert binb._HOOKS["foo"]['doc'] == "doc" assert binb._HOOKS["foo"]['app'] == "app" with pytest.raises(RuntimeError):
( 'bounce', (1, 0, 0) ), ( 'cosine', (1, 0, 0) ), ( 'count', (1, 0, 0) ), ( 'force', (1, 0, 0) ), ( 'linear', (1, 0, 0) ), ( 'repeat', (1, 0, 0) ), ( 'sine', (1, 0, 0) ), ), INTERNAL: ( ) } Test_api = verify_api(bd, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- ALL = ( 'bounce', 'cosine', 'count', 'force', 'linear', 'repeat', 'sine', )
api = { GENERAL: ( ), DEV: ( ( 'WebSocketClientConnectionWrapper', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.write_message', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.close', (1, 0, 0) ), ( 'WebSocketClientConnectionWrapper.read_message', (1, 0, 0) ), ) } Test_api = verify_api(bcw, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- class Test_WebSocketClientConnectionWrapper(object):
api = { GENERAL: ( ('export_png', (1, 0, 0)), ('export_svgs', (1, 0, 0)), ), DEV: ( ('get_screenshot_as_png', (1, 0, 0)), ('get_svgs', (1, 0, 0)), ('save_layout_html', (1, 0, 0)), ('wait_until_render_complete', (1, 0, 0)), ('terminate_web_driver', (1, 0, 0)), ), } Test_api = verify_api(bie, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- @pytest.mark.unit
# API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ), DEV: ( ( 'notebook_content', (1,0,0) ), ) } Test_api = verify_api(ben, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- @pytest.fixture def test_plot(): from bokeh.plotting import figure test_plot = figure() test_plot.circle([1, 2], [2, 3]) return test_plot #----------------------------------------------------------------------------- # General API #-----------------------------------------------------------------------------
import bokeh.colors.util as bcu #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { GENERAL: (), DEV: ( ('ColorGroup', (1, 0, 0)), ('NamedColor', (1, 0, 0)), ('NamedColor.to_css', (1, 0, 0)), ) } Test_api = verify_api(bcu, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- class _TestGroup(bcu.ColorGroup): _colors = ("Red", "Green", "Blue") #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
import bokeh.io.output as bio #----------------------------------------------------------------------------- # API Definition #----------------------------------------------------------------------------- api = { GENERAL: ( ('output_file', (1, 0, 0)), ('output_notebook', (1, 0, 0)), ('reset_output', (1, 0, 0)), ), DEV: () } Test_api = verify_api(bio, api) #----------------------------------------------------------------------------- # Setup #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Test_output_file(object): @patch('bokeh.io.state.State.output_file') def test_no_args(self, mock_output_file): default_kwargs = dict(title="Bokeh Plot", mode="cdn", root_dir=None) bio.output_file("foo.html")