def test_legend_item_with_field_label_raises_error_if_field_not_in_cds(): legend_item = LegendItem() gr_1 = GlyphRenderer(data_source=ColumnDataSource()) legend_item.label = field('label') legend_item.renderers = [gr_1] with mock.patch('bokeh.core.validation.check.logger') as mock_logger: check_integrity([legend_item]) assert mock_logger.error.call_count == 1
def test_legend_item_with_value_label_and_different_data_sources_does_not_raise_a_validation_error(): legend_item = LegendItem() gr_1 = GlyphRenderer(data_source=ColumnDataSource()) gr_2 = GlyphRenderer(data_source=ColumnDataSource()) legend_item.label = value('label') legend_item.renderers = [gr_1, gr_2] with mock.patch('bokeh.core.validation.check.logger') as mock_logger: check_integrity([legend_item]) assert mock_logger.error.call_count == 0