def test_file_html_handles_css_only_resources(): css_resources = CSSResources(mode="relative", components=["bokeh"]) template = Template("<head>{{ bokeh_css }}</head><body></body>") output = embed.file_html(_embed_test_plot, (None, css_resources), "title", template=template) html = "<head>%s</head><body></body>" % css_resources.render_css() assert output == html
def test_file_html_handles_css_only_resources(self, mock_warn, test_plot): css_resources = CSSResources(mode="relative", components=["bokeh"]) template = Template("<head>{{ bokeh_css }}</head><body></body>") output = bes.file_html(test_plot, (None, css_resources), "title", template=template) html = encode_utf8("<head>%s</head><body></body>" % css_resources.render_css()) assert output == html
def test_file_html_provides_warning_if_no_js(self, mock_warn, test_plot): css_resources = CSSResources() bes.file_html(test_plot, (None, css_resources), "title") mock_warn.assert_called_once_with( 'No Bokeh JS Resources provided to template. If required you will need to provide them manually.' )
import_marker = process_PAsearch.get_markerpos(stub_loc['stub_dir'][0]) df_MRK = pd.DataFrame.from_dict(import_marker, orient='index') df_MRK.columns = ['StgX', 'StgY'] # add the column names # ------------ Create the plots -------------- # Open our custom template with open('PB_template.jinja', 'r') as f: template = Template(f.read()) # Use inline resources, render the html and open bokehlayout = create_bokehplot.makelayout(df_EDAX, df_MRK, img_list) title = 'Particle Search Results' js_resources = JSResources(mode='cdn') css_resources = CSSResources(mode='cdn') html = file_html(bokehlayout, resources=(js_resources, css_resources), title=title, template=template, template_variables=sample_info) script, div = components(bokehlayout) """html = template.render(js_resources=js_resources, css_resources=css_resources, div=div)""" output_file = directory + '.html' with open(directory + '/' + output_file, mode='w', encoding='utf-8') as f: f.write(html)
def test_file_html_handles_css_only_resources(): css_resources = CSSResources(mode="relative", components=["bokeh"]) template = Template("<head>{{ bokeh_css }}</head><body></body>") output = embed.file_html(_embed_test_plot, (None, css_resources), "title", template=template) html = encode_utf8("<head>%s</head><body></body>" % css_resources.render_css()) assert output == html
def test_file_html_handles_css_only_resources(): css_resources = CSSResources(mode="relative") template = Template("<head>{{ bokeh_css }}</head><body></body>") output = embed.file_html(_embed_test_plot, None, "title", template=template, css_resources=css_resources) html = "<head>%s</head><body></body>" % css_resources.use_widgets(False).render_css() assert output == html
def test_file_html_handles_css_only_resources(self, mock_warn, test_plot) -> None: css_resources = CSSResources(mode="relative", components=["bokeh"]) template = Template("<head>{{ bokeh_css }}</head><body></body>") output = bes.file_html(test_plot, (None, css_resources), "title", template=template) html = "<head>%s</head><body></body>" % css_resources.render_css() assert output == html