def test_warns_on_non_convergence(caplog: LogCaptureFixture) -> None:
    """Test that the model warns when it does not converge."""
    # Create a GaussianMixture model
    model = GaussianMixture(n_components=2, n_iter=1)

    # Create some synthetic data
    data = torch.cat(
        [
            torch.randn(100, 2) + torch.tensor([2.0, 2.0]),
            torch.randn(100, 2) + torch.tensor([-2.0, -2.0]),
        ],
    )

    # Fit the model to the data
    with caplog.at_level(logging.WARNING):
        model.fit(data)

    assert "GMM did not converge" in caplog.text
Test that the model warns when it does not converge.
tests/unit/models/components/clustering/test_gmm.py