Пример #1
0
def test_plot_does_nothing_before_fit(fit_func, fit_data):
    model = Model(fit_func)

    plt.figure()
    model.plot()

    assert (len(plt.gca().lines) == 0)
Пример #2
0
def test_plot_plots_fitted_func(fit_func, fit_data):
    model = Model(fit_func)
    model.fit(*fit_data)

    plt.figure()
    model.plot()

    assert (len(plt.gca().lines) > 0)
Пример #3
0
def test_plot_uses_dx_point_spacing(fit_func, fit_data):
    model = Model(fit_func)
    model.fit(*fit_data)

    plt.figure()
    model.plot(dx=0.1)

    line = plt.gca().lines[0]
    xdata = line.get_xdata()

    assert (len(xdata) == 60 or len(xdata) == 61)
Пример #4
0
def test_plot_uses_n_points(fit_func, fit_data):
    model = Model(fit_func)
    model.fit(*fit_data)

    plt.figure()
    model.plot(n=1000)

    line = plt.gca().lines[0]
    xdata = line.get_xdata()

    assert (len(xdata) == 1000)
Пример #5
0
def test_plot_uses_plot_style(fit_func, fit_data):
    model = Model(fit_func)
    model.fit(*fit_data)

    plt.figure()
    model.plot(style='--')

    line = plt.gca().lines[0]
    style = line.get_linestyle()

    assert (style == '--')