def multiple_views(build_path, monkeypatch): """Create multiple views app.""" monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_multiple') app = App() view1 = View() # pylint: disable=unused-variable assert view1._uuid == 2 # pylint: disable=protected-access view2 = View() view2.add(table) app.add_route(view2, 'view2') app.add(table) app.add_sidebar(ctrl) app.add_sidebar(ctrl2) app.subscribe(callback, ctrl.on_change) app.subscribe(callback, ctrl2.on_click) app._build() # pylint: disable=protected-access env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', '')) server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env) time.sleep(5) yield server.kill()
def main(): from bowtie import App app = App(title='Network DownScaler') app.add(sine_plot) app.add_sidebar(upload) app.subscribe(upload_listener, upload.on_upload) app.add_sidebar(scale_factor_input) app.subscribe(update_scale_factor, scale_factor_input.on_change) app.add_sidebar(mark) #app.add_sidebar(text) #app.subscribe(write, text.on_change) app.add_sidebar(run_button) app.subscribe(button_listener, run_button.on_click) app.add_sidebar(freq_slider) app.subscribe(slider_listener, freq_slider.on_change) app.add_sidebar(dropdown_src) app.add_sidebar(dropdown_dst) app.subscribe(dropdown_src_listener, dropdown_src.on_change) app.subscribe(dropdown_dst_listener, dropdown_dst.on_change) return app
def dummy(build_reset, monkeypatch): """Create basic app.""" app = App(__name__) app.add(button) app.subscribe(button.on_click)(click) app._build() # pylint: disable=protected-access with server_check(app) as server: yield server
def dummy(build_reset, monkeypatch): """Create basic app.""" app = App(__name__) app.add(button) app.subscribe(button.on_click)(click) app._build() # pylint: disable=protected-access with server_check(app) as server: yield server
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 main(): app = App(rows=3, columns=2, sidebar=False, debug=True) app.rows[0].auto() app[0] = catdd app[1] = stars app[2, 0] = busy app[2, 1] = revdate app.subscribe(viz, catdd.on_change) app.subscribe(vizplace, stars.on_click) return app
def markdown(build_reset, monkeypatch): """Create markdown and text widgets.""" app = App(__name__, sidebar=True) app.add(mark) app.add_sidebar(side) app.add_sidebar(text) app.subscribe(text.on_change)(write) # pylint: disable=protected-access app._build() with server_check(app) as server: yield server
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 dummy(build_path, monkeypatch): """Create basic app.""" monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_cache') app = App() app.add(button) app.subscribe(click, button.on_click) # pylint: disable=protected-access app._build() with server_check(build_path) as server: yield server
def markdown(build_reset, monkeypatch): """Create markdown and text widgets.""" app = App(__name__, sidebar=True) app.add(mark) app.add_sidebar(side) app.add_sidebar(text) app.subscribe(text.on_change)(write) # pylint: disable=protected-access app._build() with server_check(app) as server: yield server
def plotly(build_reset, monkeypatch): """Create plotly app.""" app = App(__name__, sidebar=True) app.add(viz) app.add_sidebar(ctrl) app.add_sidebar(ctrl_range) app.add_sidebar(ctrl2) app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback)) # pylint: disable=protected-access app._build() with server_check(app) as server: yield server
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 multiple_views(build_reset, monkeypatch): """Create multiple views app.""" app = App(__name__, sidebar=True) view1 = View() # pylint: disable=unused-variable assert view1._uuid == 2 # pylint: disable=protected-access view2 = View() view2.add(table) app.add_route(view2, 'view2') app.add(table) app.add_sidebar(ctrl) app.add_sidebar(ctrl2) app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback)) app._build() # pylint: disable=protected-access with server_check(app) as server: yield server
def multiple_views(build_reset, monkeypatch): """Create multiple views app.""" app = App(__name__, sidebar=True) view1 = View() # pylint: disable=unused-variable assert view1._uuid == 2 # pylint: disable=protected-access view2 = View() view2.add(table) app.add_route(view2, 'view2') app.add(table) app.add_sidebar(ctrl) app.add_sidebar(ctrl2) app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback)) app._build() # pylint: disable=protected-access with server_check(app) as server: yield server
def plotly(build_path, monkeypatch): """Create plotly app.""" monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_plotly') app = App() app.add(viz) app.add_sidebar(ctrl) app.add_sidebar(ctrl_range) app.add_sidebar(ctrl2) app.subscribe(callback, ctrl.on_change) app.subscribe(callback, ctrl2.on_click) # pylint: disable=protected-access app._build() env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', '')) server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env) time.sleep(5) yield server.kill()
def test_markdown(chrome_driver, build_path): """Test markdown and text widgets.""" app = App(directory=build_path) app.add(mark) app.add_sidebar(side) app.add_sidebar(text) app.subscribe(write, text.on_change) app.build() env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', '')) server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env) time.sleep(5) chrome_driver.get('http://*****:*****@style='grid-area: 1 / 2 / 2 / 3; position: relative;']") assert 'top' in output.text assert 'middle' in output.text assert 'link' in output.text txtctrl.send_keys('apple') time.sleep(1) assert 'apple' in output.text txtctrl.send_keys('banana') time.sleep(1) assert 'apple' in output.text assert 'banana' in output.text server.kill()
def markdown(build_path, monkeypatch): """Create markdown and text widgets.""" monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_editor') app = App() app.add(mark) app.add_sidebar(side) app.add_sidebar(text) app.subscribe(write, text.on_change) # pylint: disable=protected-access app._build() env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', '')) server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env) time.sleep(5) yield server.kill()
def test_plotly(chrome_driver, build_path): """Tests plotly.""" app = App(directory=build_path) app.add(viz) app.add_sidebar(ctrl) app.add_sidebar(ctrl2) app.subscribe(callback, ctrl.on_change) app.subscribe(callback, ctrl2.on_click) app.build() env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', '')) server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env) time.sleep(5) chrome_driver.get('http://localhost:9991') chrome_driver.implicitly_wait(5) assert chrome_driver.title == 'Bowtie App' button = chrome_driver.find_element_by_class_name('ant-btn') button.click() points = chrome_driver.find_elements_by_class_name('point') logs = chrome_driver.get_log('browser') for log in logs: if log['level'] == 'SEVERE': raise Exception(log['message']) assert len(points) == 4 server.kill()
def test_subscribe_error(): """Subscribe with incorrect argument order.""" app = App() with pytest.raises(IndexError): app.subscribe()
def test_subscribe_error(): """Subscribe with incorrect argument order.""" app = App() button = Button() with pytest.raises(TypeError): app.subscribe(3, button.on_click)