def create_components(): """Create components for this test.""" reset_uuid() # pylint: disable=protected-access controllers = [] for compstr in dir(control): comp = getattr(control, compstr) if (compstr[0] != '_' and isclass(comp) and issubclass(comp, control._Controller) and compstr != 'Upload'): controllers.append(comp()) for controller in controllers: assert COMPONENT_REGISTRY[controller._uuid] == controller visuals = [] for compstr in dir(visual): comp = getattr(visual, compstr) if compstr[0] != '_' and isclass(comp) and issubclass(comp, visual._Visual): visuals.append(comp()) for vis in visuals: assert COMPONENT_REGISTRY[vis._uuid] == vis htmls = [] for compstr in dir(html): comp = getattr(html, compstr) if compstr[0] != '_' and isclass(comp) and issubclass(comp, html._HTML): htmls.append(comp()) for htm in htmls: assert COMPONENT_REGISTRY[htm._uuid] == htm return controllers, visuals, htmls
def create_components(): """Create components for this test.""" reset_uuid() # pylint: disable=protected-access controllers = [] for compstr in dir(control): comp = getattr(control, compstr) if (compstr[0] != '_' and isclass(comp) and issubclass(comp, control._Controller) and compstr != 'Upload'): controllers.append(comp()) for controller in controllers: assert COMPONENT_REGISTRY[controller._uuid] == controller visuals = [] for compstr in dir(visual): comp = getattr(visual, compstr) if compstr[0] != '_' and isclass(comp) and issubclass(comp, visual._Visual): visuals.append(comp()) for vis in visuals: assert COMPONENT_REGISTRY[vis._uuid] == vis htmls = [] for compstr in dir(html): comp = getattr(html, compstr) if compstr[0] != '_' and isclass(comp) and issubclass(comp, html._HTML): htmls.append(comp()) for htm in htmls: assert COMPONENT_REGISTRY[htm._uuid] == htm return controllers, visuals, htmls
def test_build(build_path): """Tests the build process.""" reset_uuid() ctrl = Nouislider() viz = Plotly() app = App(directory=build_path) app.add_sidebar(ctrl) app.add(viz) app.subscribe(callback, ctrl.on_change) app.build()
def test_build(build_path): """Tests the build process.""" reset_uuid() ctrl = Nouislider() viz = Plotly() layout = Layout(directory=build_path) layout.add_sidebar(ctrl) layout.add(viz) layout.subscribe(callback, ctrl.on_change) layout.build()
def test_build(build_reset, monkeypatch): """Tests the build process.""" reset_uuid() ctrl = Nouislider() viz = Plotly() app = App(__name__, sidebar=True) app.add_sidebar(ctrl) app.add(viz) app.subscribe(ctrl.on_change)(callback) # pylint: disable=protected-access app._build()
def test_build(build_path, monkeypatch): """Tests the build process.""" monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_compile') reset_uuid() ctrl = Nouislider() viz = Plotly() app = App() app.add_sidebar(ctrl) app.add(viz) app.subscribe(callback, ctrl.on_change) # pylint: disable=protected-access app._build()
def create_components(): """Create components for this test.""" reset_uuid() # pylint: disable=protected-access controllers = [ getattr(control, comp)() for comp in dir(control) if comp[0].isupper() and issubclass( getattr(control, comp), control._Controller) and comp != 'Upload' ] for controller in controllers: assert COMPONENT_REGISTRY[controller._uuid] == controller visuals = [ getattr(visual, comp)() for comp in dir(visual) if comp[0].isupper() and issubclass(getattr(visual, comp), visual._Visual) ] for vis in visuals: assert COMPONENT_REGISTRY[vis._uuid] == vis return controllers, visuals
"""Test markdown and text widgets.""" # pylint: disable=redefined-outer-name,unused-argument,invalid-name import time import pytest from bowtie import App from bowtie.html import Markdown from bowtie.control import Textbox from bowtie.tests.utils import reset_uuid, server_check reset_uuid() mark = Markdown(''' # top ## middle [link]('hello.html') ''') side = Markdown(''' # sideheader ''') text = Textbox(area=True) def write(txt): """Update markdown text.""" mark.do_text(txt)
# -*- coding: utf-8 -*- """Test markdown and text widgets.""" import time import pytest from bowtie import App, cache from bowtie.control import Button from bowtie.tests.utils import reset_uuid, server_check reset_uuid() # pylint: disable=invalid-name button = Button() store = {} def click(): """Update markdown text.""" cache['a'] = 3 assert cache[b'a'] == 3 assert cache[u'a'] == 3 cache[b'b'] = True assert cache[b'b'] assert cache[u'b'] def test_keys(): """Test invalid keys.""" with pytest.raises(KeyError): cache[0] = 0