Warning raised in tests for `QuadraticDiscriminantAnalysis`

### Describe the bug

I wonder whether the behavior of `QuadraticDiscriminatAnalysis` producing the Warning in the test below is as intended, or a problem to be fixed. 

The test `test_qda_regularization` checks some of QDA's handling of rank deficient matrices. It starts by testing the class on data `X2` where the second variable is a constant. The first part of the test is as follows:

```python
def test_qda_regularization():
    # The default is reg_param=0. and will cause issues when there is a
    # constant variable.

    # Fitting on data with constant variable without regularization
    # triggers a LinAlgError.
    msg = r"The covariance matrix of class .+ is not full rank"
    clf = QuadraticDiscriminantAnalysis()
    with pytest.warns(linalg.LinAlgWarning, match=msg):
        y_pred = clf.fit(X2, y6)

    y_pred = clf.predict(X2)
    assert np.any(y_pred != y6)
```

The first detail here is that the comment mentioned `LinAlgError`, but the test and the class use `LinAlgWarning`. When fitting the class, a `LinAlgWarning` is raised as expected. But the class is still instantiated with rank-deficient parameters.

In the second part we obtain `y_pred` with the a rank-defficient matrix, leading to wrong outputs, and raising the Warning:

``` 
>       y_pred = clf.predict(X2)                                 
                 ^^^^^^^^^^^^^^^                                 
                                                                 
sklearn/tests/test_discriminant_analysis.py:607:                 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sklearn/discriminant_analysis.py:1095: in predict                
    return super().predict(X)                                    
           ^^^^^^^^^^^^^^^^^^                                    
sklearn/discriminant_analysis.py:210: in predict                 
    scores = self._decision_function(X)                          
             ^^^^^^^^^^^^^^^^^^^^^^^^^^                          
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
                                                                 
self = QuadraticDiscriminantAnalysis()                           
X = array([[-3,  0],                                             
       [-2,  0],                                                 
       [-1,  0],                                                 
       [-1,  0],                                                 
       [ 0,  0],                                                 
       [ 1,  0],                                                 
       [ 1,  0],                                                 
       [ 2,  0],                                                 
       [ 3,  0]])                                                
                                                                 
    def _decision_function(self, X):                             
        # return log posterior, see eq (4.12) p. 110 of the ESL. 
        check_is_fitted(self)                                    
                                                                 
        X = validate_data(self, X, reset=False)                  
        norm2 = []                                               
        for i in range(len(self.classes_)):                      
            R = self.rotations_[i]                               
            S = self.scalings_[i]                                
            Xm = X - self.means_[i]                              
>           X2 = np.dot(Xm, R * (S ** (-0.5)))                   
                                 ^^^^^^^^^^^                     
E           RuntimeWarning: divide by zero encountered in power  
```

I am wondering whether it would be desirable to change the `LinAlgWarning` for a `LinAlgError`, to prevent users from unknowingly using pathological models.

If not, I wonder whether it would be desirable to modify the test to 1) remove the first assignment of `y_pred`,  2) make it not raise a warning, and 3) make the comment say `LinAlgWarning` instead of `LinAlgError`. Something like the edit below:

```python
def test_qda_regularization():
    # The default is reg_param=0. and will cause issues when there is a
    # constant variable.

    # Fitting on data with constant variable without regularization
    # triggers a LinAlgWarning.
    msg = r"The covariance matrix of class .+ is not full rank"
    clf = QuadraticDiscriminantAnalysis()
    with pytest.warns(linalg.LinAlgWarning, match=msg):
        clf.fit(X2, y6)

    with pytest.warns():
        y_pred = clf.predict(X2)
```

To get this output, run

```
PYTHONWARNINGS=error pytest sklearn/tests/test_discriminant_analysis.py -k test_qda_regularization
```

### Steps/Code to Reproduce

```
PYTHONWARNINGS=error pytest sklearn/tests/test_discriminant_analysis.py -k test_qda_regularization
```

### Expected Results

If we change the `LinAlgWarning` with a `LinAlgError` inside of `QuadraticDiscriminantAnalysis`, users would not be able to use models with rank-deficient class covariances to get predictions.

### Actual Results

```
>       y_pred = clf.predict(X2)                                 
                 ^^^^^^^^^^^^^^^                                 
                                                                 
sklearn/tests/test_discriminant_analysis.py:607:                 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sklearn/discriminant_analysis.py:1095: in predict                
    return super().predict(X)                                    
           ^^^^^^^^^^^^^^^^^^                                    
sklearn/discriminant_analysis.py:210: in predict                 
    scores = self._decision_function(X)                          
             ^^^^^^^^^^^^^^^^^^^^^^^^^^                          
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
                                                                 
self = QuadraticDiscriminantAnalysis()                           
X = array([[-3,  0],                                             
       [-2,  0],                                                 
       [-1,  0],                                                 
       [-1,  0],                                                 
       [ 0,  0],                                                 
       [ 1,  0],                                                 
       [ 1,  0],                                                 
       [ 2,  0],                                                 
       [ 3,  0]])                                                
                                                                 
    def _decision_function(self, X):                             
        # return log posterior, see eq (4.12) p. 110 of the ESL. 
        check_is_fitted(self)                                    
                                                                 
        X = validate_data(self, X, reset=False)                  
        norm2 = []                                               
        for i in range(len(self.classes_)):                      
            R = self.rotations_[i]                               
            S = self.scalings_[i]                                
            Xm = X - self.means_[i]                              
>           X2 = np.dot(Xm, R * (S ** (-0.5)))                   
                                 ^^^^^^^^^^^                     
E           RuntimeWarning: divide by zero encountered in power  
```

### Versions

```shell
System:
    python: 3.11.13 | packaged by conda-forge | (main, Jun  4 2025, 14:48:23) [GCC 13.3.0]
executable: /home/dherresp-adm/Packages/miniconda3/envs/sklearn-env/bin/python3.11
   machine: Linux-5.15.0-139-generic-x86_64-with-glibc2.31

Python dependencies:
      sklearn: 1.8.dev0
          pip: 25.2
   setuptools: 80.9.0
        numpy: 2.3.2
        scipy: 1.16.1
       Cython: 3.1.3
       pandas: 2.3.2
   matplotlib: 3.10.6
       joblib: 1.5.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libopenblas
       filepath: /home/dherresp-adm/Packages/miniconda3/envs/sklearn-env/lib/libopenblasp-r0.3.30.so
        version: 0.3.30
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: libgomp
       filepath: /home/dherresp-adm/Packages/miniconda3/envs/sklearn-env/lib/libgomp.so.1.0.0
        version: None
```

COMMENT:
I think that raising a `LinAlgError` is a good option because:
1) The predicted class labels probably don't make sense, and the predicted probabilities are NaN's (see below).
2) The problem can be easily solved by adding regularization, `LinAlgError` would force the user to do this.

Below is a snippet of code to reproduce the test. While the model generates (wrong) class predictions, the estimated class probabilities are NaN's. Generating class predictions but not probabilities seems like inconsistent behavior by the model.

Maybe worth also looking into how the class prediction is able to work despite rank deficiency.

```python
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
import numpy as np

# Data that has zero variance in one dimension and needs regularization
X2 = np.array(
    [[-3, 0], [-2, 0], [-1, 0], [-1, 0], [0, 0], [1, 0], [1, 0], [2, 0], [3, 0]]
)
y6 = np.array([1, 1, 1, 1, 1, 2, 2, 2, 2])


solver = "svd"
clf = QuadraticDiscriminantAnalysis(solver=solver)
clf.fit(X2, y6)

y_pred = clf.predict(X2)
probs = clf.predict_proba(X2)
```

Labels: Bug, module:discriminant_analysis, Needs Investigation