def test_plotregistry_register(): reg = plotbase.PlotRegistry() reg.remove_all() obj = "hello" plot_class = plotbase.PlotBase reg.register(obj, "test1", plot_class) reg.remove_all()
def test_plotregistry_get(): reg = plotbase.PlotRegistry() reg.remove_all() obj = "hello" plot_class = plotbase.PlotBase reg.register(obj, "test1", plot_class, setup_fn=setup_plot) result = reg.get(obj, "test1") assert result == (plot_class, obj)
def test_plotregistry_register_overwrite(): reg = plotbase.PlotRegistry() reg.remove_all() obj = "hello" plot_class = plotbase.PlotBase reg.register(obj, "test1", plot_class) # without overwrite: KeyError assert pytest.raises(KeyError, reg.register, obj, "test1", plot_class, dict(setup_fn=setup_plot)) # with overwrite: ok reg.register(obj, "test1", plot_class, overwrite=True)
def test_plotregistry_construct(): reg = plotbase.PlotRegistry()