def test_plot_fn(foo1, foo2, foo3, bar1, bar2, bar3, SM_PU_iotargets_foo_bar_aggregate, units):
    app = PlatformUnitApplication(name="foo", iotargets=SM_PU_iotargets_foo_bar_aggregate, units=units)
    @app.register_plot('foo')
    def _plot1(df, **kwargs):
        from bokeh.charts import Scatter
        return Scatter(df, x="foo", y="bar", **kwargs)

    @app.register_plot('bar')
    @app.register_plot('foo')
    def _plot2(df, **kwargs):
        from bokeh.charts import Scatter
        return Scatter(df, x="bar", y="foo", **kwargs)

    app._targets = {'foo': [str(foo1), str(foo2), str(foo3)], 'bar': [str(bar1), str(bar2), str(bar3)]}
    app.aggregate()
    # bar
    d = app.plot('bar')
    assert isinstance(d, list)
    assert len(d) == 1
    # foo
    d = app.plot('foo')
    assert len(d) == 2
    from bokeh.charts import Chart
    assert isinstance(d[0], Chart)
    assert d[0].plot_width == 600
    d = app.plot(key="foo", plot_width=400)
    assert d[0].plot_width == 400