def test_label_already_exists(self): legend = Legend(items=[LegendItem(label=dict(field="foo"))]) renderer = GlyphRenderer() bph._handle_legend_field("foo", legend, renderer) assert len(legend.items) == 1 assert legend.items[0].label == dict(field="foo") assert legend.items[0].renderers == [renderer]
def test_bad_arg(self, arg): with pytest.raises(ValueError): bph._handle_legend_field(arg, "legend", "renderer")