本文整理汇总了Python中tests.integration.utils.has_no_console_errors函数的典型用法代码示例。如果您正苦于以下问题:Python has_no_console_errors函数的具体用法?Python has_no_console_errors怎么用?Python has_no_console_errors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_no_console_errors函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_patches_hover_still_works_when_a_seleciton_is_preselcted
def test_patches_hover_still_works_when_a_seleciton_is_preselcted(output_file_url, selenium):
# This tests an edge case interaction when Patches (specifically) is used
# with a tool that requires hit testing e.g. HitTool AND a selection is
# pre-made on the data source driving it.
plot = Plot(
x_range=Range1d(0, 100),
y_range=Range1d(0, 100),
min_border=0
)
source = ColumnDataSource(dict(
xs=[[0, 50, 50, 0], [50, 100, 100, 50]],
ys=[[0, 0, 100, 100], [0, 0, 100, 100]],
color=['pink', 'blue']
))
source.selected = {
'0d': {'glyph': None, 'indices': []},
'1d': {'indices': [1]},
'2d': {}
}
plot.add_glyph(source, Patches(xs='xs', ys='ys', fill_color='color'))
plot.add_tools(HoverTool())
plot.add_layout(LinearAxis(), 'below')
plot.add_layout(LinearAxis(), 'left')
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Hover plot and test no error
canvas = selenium.find_element_by_tag_name('canvas')
actions = ActionChains(selenium)
actions.move_to_element_with_offset(canvas, 100, 100)
actions.perform()
# If this assertion fails then there were likely errors on hover
assert has_no_console_errors(selenium)
示例2: test_arrow
def test_arrow(output_file_url, selenium, screenshot):
# Have to specify x/y range as labels aren't included in the plot area solver
plot = figure(height=HEIGHT, width=WIDTH, x_range=(0,10), y_range=(0,10), tools='', toolbar_location="above")
arrow1 = Arrow(x_start=1, y_start=3, x_end=6, y_end=8,
line_color='green', line_alpha=0.7,
line_dash='8 4', line_width=5, end=OpenHead()
)
arrow1.end.line_width=8
arrow2 = Arrow(x_start=2, y_start=2, x_end=7, y_end=7,
start=NormalHead(), end=VeeHead()
)
arrow2.start.fill_color = 'indigo'
arrow2.end.fill_color = 'orange'
arrow2.end.size = 50
plot.add_layout(arrow1)
plot.add_layout(arrow2)
# Save the plot and start the test
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Take screenshot
assert screenshot.is_valid()
示例3: test_label
def test_label(output_file_url, selenium, screenshot):
# Have to specify x/y range as labels aren't included in the plot area solver
plot = Plot(plot_height=HEIGHT, plot_width=WIDTH,
x_range=Range1d(0, 10), y_range=Range1d(0, 10),
toolbar_location=None)
label1 = Label(x=1, y=6, x_offset=25, y_offset=25,
text="Demo Label",
text_font_size='38pt', text_color='red', text_alpha=0.9,
text_baseline='bottom', text_align='left',
background_fill_color='green', background_fill_alpha=0.2,
angle=15, angle_units='deg',
render_mode='canvas')
label2 = Label(x=3, y=5.5, text="(I'm Canvas)", text_font_size='20pt',
border_line_color='black', border_line_width=2, border_line_dash='8 4',
render_mode='canvas')
label3 = Label(x=1, y=2, x_offset=25, y_offset=25,
text="Demo Label",
text_font_size='38pt', text_color='red', text_alpha=0.9,
text_baseline='bottom', text_align='left',
background_fill_color='green', background_fill_alpha=0.2,
angle=0.261, angle_units='rad',
render_mode='css')
label4 = Label(x=3, y=1.0, text="(I'm CSS)", text_font_size='20pt',
border_line_color='black', border_line_width=2, border_line_dash='8 4',
render_mode='css')
label_above = Label(
x=0, y=0, text="Label in above panel", x_units='screen', y_units='screen',
text_font_size='38pt', text_color='firebrick', text_alpha=0.9,
)
label_left = Label(
x=0, y=0, text="Label in left panel",
x_units='screen', y_units='screen', angle=90, angle_units='deg',
text_font_size='18pt', text_color='firebrick', text_alpha=0.9,
background_fill_color='aliceblue', text_baseline='top',
)
plot.add_layout(LinearAxis(), 'below')
plot.add_layout(LinearAxis(), 'left')
plot.add_layout(label1)
plot.add_layout(label2)
plot.add_layout(label3)
plot.add_layout(label4)
plot.add_layout(label_above, 'above')
plot.add_layout(label_left, 'left')
# Save the plot and start the test
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Take screenshot
screenshot.assert_is_valid()
示例4: test_lasso_select
def test_lasso_select(output_file_url, selenium):
plot = generate_plot()
#limit to one callback on click release
plot.add_tools(LassoSelectTool(select_every_mousemove=False))
# Save the plot and start the test
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Drag a lasso selection area around middle point
canvas = selenium.find_element_by_tag_name('canvas')
actions = ActionChains(selenium)
actions.move_to_element_with_offset(canvas, PLOT_DIM * 0.25, PLOT_DIM * 0.25)
actions.click_and_hold()
actions.move_by_offset(0, PLOT_DIM * 0.5)
actions.move_by_offset(PLOT_DIM * 0.5, 0)
actions.move_by_offset(0, PLOT_DIM * -0.5)
actions.release()
actions.perform()
# Get the alert from box select and assert that the middle item is selected
alert = selenium.switch_to_alert()
assert alert.text == 'middle'
示例5: test_color_bar_placement_and_render
def test_color_bar_placement_and_render(output_file_url, selenium, screenshot):
plot = Plot(height=HEIGHT, width=WIDTH,
x_range=Range1d(0,10), y_range=Range1d(0,10),
toolbar_location=None)
bar_vertical_right_panel = create_vertical_color_bar_with_log_cmap()
bar_vertical_right_panel.location = (0, 0)
bar_vertical_in_frame = create_vertical_color_bar_with_log_cmap()
bar_vertical_in_frame.location = "top_right"
bar_vertical_in_frame.title = "Dummy Title"
bar_vertical_in_frame.title_standoff = 7
bar_horizontal_below_panel = create_horizontal_color_bar_with_linear_cmap()
bar_horizontal_below_panel.location = (0, 0)
bar_horizontal_in_frame = create_horizontal_color_bar_with_linear_cmap()
bar_horizontal_in_frame.location = "bottom_left"
bar_horizontal_in_frame.title = "Dummy Title"
plot.add_layout(bar_vertical_right_panel, 'right')
plot.add_layout(bar_vertical_in_frame)
plot.add_layout(bar_horizontal_below_panel, 'below')
plot.add_layout(bar_horizontal_in_frame)
# Save the plot and start the test
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Take screenshot
screenshot.assert_is_valid()
示例6: test_reversed_y_range_does_not_pan_below_y_max
def test_reversed_y_range_does_not_pan_below_y_max(output_file_url, selenium):
y_range_max = 4
plot = make_pan_plot_with_callback(yr=Range1d(3, 0, bounds=(None, y_range_max)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=50, pan_y=-150)
new_range_end = float(selenium.execute_script("""alert(window.get_y_range_start())"""))
selenium.switch_to_alert().dismiss()
assert round(new_range_end) == y_range_max
示例7: test_reversed_x_range_does_not_pan_left_of_x_max
def test_reversed_x_range_does_not_pan_left_of_x_max(output_file_url, selenium):
x_range_max = 4
plot = make_pan_plot_with_callback(xr=Range1d(3, 0, bounds=(None, x_range_max)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=200, pan_y=0)
new_range_end = float(selenium.execute_script("""alert(window.get_x_range_start())"""))
selenium.switch_to_alert().dismiss() # This is not necessary but assists debugging
assert round(new_range_end) == x_range_max
示例8: test_y_range_does_not_pan_above_y_max
def test_y_range_does_not_pan_above_y_max(output_file_url, selenium):
y_range_max = 4
plot = make_pan_plot_with_callback(yr=Range1d(0, 3, bounds=(None, y_range_max)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=50, pan_y=150)
new_range_end = float(selenium.execute_script("""alert(window.get_y_range_end())"""))
selenium.switch_to_alert().dismiss() # This is not necessary but assists debugging
assert round(new_range_end) == y_range_max
示例9: test_y_range_does_not_pan_below_y_min
def test_y_range_does_not_pan_below_y_min(output_file_url, selenium):
y_range_min = -1
plot = make_plot(yr=Range1d(0, 3, bounds=(y_range_min, None)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=50, pan_y=-150)
new_range_start = float(selenium.execute_script("""alert(Bokeh.index['plot-id'].model.y_range.start)"""))
selenium.switch_to_alert().dismiss() # This is not necessary but assists debugging
assert round(new_range_start) == y_range_min
示例10: test_reversed_x_range_does_not_pan_right_of_x_min
def test_reversed_x_range_does_not_pan_right_of_x_min(output_file_url, selenium):
x_range_min = -1
plot = make_plot(xr=Range1d(3, 0, bounds=(x_range_min, None)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=-150, pan_y=0)
new_range_start = float(selenium.execute_script("""alert(Bokeh.index['plot-id'].model.x_range.min)"""))
selenium.switch_to_alert().dismiss()
assert round(new_range_start) == x_range_min
示例11: test_x_range_does_not_pan_right_of_x_max
def test_x_range_does_not_pan_right_of_x_max(output_file_url, selenium):
x_range_max = 4
plot = make_plot(xr=Range1d(0, 3, bounds=(None, x_range_max)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=-150, pan_y=0)
new_range_end = float(selenium.execute_script("""alert(Bokeh.index['plot-id'].model.x_range.end)"""))
selenium.switch_to_alert().dismiss() # This is not necessary but assists debugging
assert round(new_range_end) == x_range_max
示例12: test_x_range_does_not_pan_left_of_x_min
def test_x_range_does_not_pan_left_of_x_min(output_file_url, selenium):
x_range_min = -1
plot = make_pan_plot_with_callback(xr=Range1d(0, 3, bounds=(x_range_min, None)))
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Pan plot and test for new range value
pan_plot(selenium, pan_x=200, pan_y=0)
new_range_start = float(selenium.execute_script("""alert(window.get_x_range_start())"""))
selenium.switch_to_alert().dismiss()
assert round(new_range_start) == x_range_min
示例13: test_selection_tool_make_selection
def test_selection_tool_make_selection(output_file_url, selenium):
plot = make_plot()
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
perform_box_selection(selenium, (50, 200), (450, 400))
code = "return Bokeh.index['plot-id'].model.select_one('rect-glyph').data_source.selected['1d'].indices"
selected = selenium.execute_script(code)
assert selected == [0, 1]
示例14: test_selection_tool_selection_ending_outside_frame_makes_selection
def test_selection_tool_selection_ending_outside_frame_makes_selection(output_file_url, selenium):
plot = make_plot()
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# make selection ending outside of frame
perform_box_selection(selenium, (50, 50), (1000, 1000))
code = "return Bokeh.index['plot-id'].model.select_one('rect-glyph').data_source.selected['1d'].indices"
selected = selenium.execute_script(code)
assert selected == [0,1,2]
示例15: test_wheel_zoom_is_deselected_by_default
def test_wheel_zoom_is_deselected_by_default(output_file_url, selenium):
# Make plot and add a taptool callback that generates an alert
plot = make_plot()
# Save the plot and start the test
save(plot)
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Tap the plot and test for alert
scroll_button = get_non_stale_scroll_button(selenium)
scroll_classes = scroll_button.get_attribute('class')
assert 'active' not in scroll_classes