def test_convergence_warning(X, y, max_iter):
    """Test that the ConvergenceWarning is raised."""
    clf = CrossEntropyLearningShapelets(learning_rate=1e-3, tol=1e-9,
                                        random_state=42, max_iter=max_iter)
    msg = ('Maximum number of iterations reached without converging. Increase '
           'the maximum number of iterations.')
    with pytest.warns(ConvergenceWarning, match=msg):
        clf.fit(X, y)
Test that the ConvergenceWarning is raised.
pyts/classification/tests/test_learning_shapelets.py