示例#1
0
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()
示例#2
0
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)
示例#3
0
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)
示例#4
0
def test_plotregistry_construct():
    reg = plotbase.PlotRegistry()