Beispiel #1
0
def test_canvas_too_many_plots():
    """Assert that the canvas works."""
    atom = ATOMClassifier(X_bin, y_bin, random_state=1)
    atom.run("Tree")
    with atom.canvas(1, 2, display=False):
        atom.plot_prc()
        atom.plot_roc()
        pytest.raises(RuntimeError, atom.plot_prc)
Beispiel #2
0
def test_figure_is_saved_canvas(func):
    """Assert that the figure is only saved after finishing the canvas."""
    atom = ATOMClassifier(X_bin, y_bin, random_state=1)
    atom.run("Tree")
    with atom.canvas(1, 2, filename="canvas", display=False):
        atom.plot_prc()
        func.assert_not_called()
        atom.plot_roc()
        func.assert_not_called()
    func.assert_called_with("canvas")  # Only at the end it is saved
Beispiel #3
0
def test_force_plot():
    """Assert that the force_plot method work as intended."""
    atom = ATOMClassifier(X_class, y_class, random_state=1)
    pytest.raises(NotFittedError, atom.force_plot)
    atom.run("Tree", metric="MSE")
    with atom.canvas(display=False):
        pytest.raises(PermissionError, atom.force_plot, matplotlib=True)
    atom.force_plot(index=100, matplotlib=True, display=False)
    atom.force_plot(matplotlib=False,
                    filename=FILE_DIR + "force",
                    display=True)
    assert glob.glob(FILE_DIR + "force.html")
Beispiel #4
0
def test_plot_scatter_matrix():
    """Assert that the plot_scatter_matrix method work as intended."""
    atom = ATOMClassifier(X_bin, y_bin, random_state=1)
    with atom.canvas():
        pytest.raises(PermissionError, atom.plot_scatter_matrix)
    atom.plot_scatter_matrix(columns=[0, 1, 2], display=False)