Inconsistency in AUC ROC and AUPR API

### Describe the bug

When only one class is present on the groundtruth. The function `roc_auc_score` throws an `ValueError` and exits while the `average_precision_score` returns `-0.0`. I feel that both functions should return similar output in this case.

### Steps/Code to Reproduce

```python
from sklearn.metrics import roc_auc_score,  average_precision_score

y_true = [1]*10
prob = [0.49]*10

auc_roc = roc_auc_score(y_true, prob)
aupr= average_precision_score(y_true, prob)

```

### Expected Results

auc_roc = roc_auc_score(y_true, prob) >> throws `ValueError: Only one class present in y_true. ROC AUC score is not defined in that case`

aupr=-0.0

### Actual Results

Both should have similar outputs

### Versions

```shell
Python dependencies:                                                                                                
      sklearn: 1.1.2                                                                                                
          pip: 22.0.2                                                                                               
   setuptools: 59.6.0                                                                                               
        numpy: 1.23.2                                                                                               
        scipy: 1.9.1                                                                                                
       Cython: None                                                                                                 
       pandas: 1.4.3                                                                                                
   matplotlib: 3.5.3                                                                                                
       joblib: 1.1.0                                                                                                
threadpoolctl: 3.1.0  

Built with OpenMP: True                                                                                             
                                                                                                                    
threadpoolctl info:          
       user_api: openmp      
   internal_api: openmp      
         prefix: libgomp     
       filepath: /home/abhijeet/Code/GMML/.gmml/lib/python3.10/sitepackages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0    

version: None        
    num_threads: 24          

       user_api: blas        
   internal_api: openblas    
         prefix: libopenblas                              
       filepath: /home/abhijeet/Code/GMML/.gmml/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-742d56dc.
3.20.so                      
        version: 0.3.20      
threading_layer: pthreads    
   architecture: SkylakeX    
    num_threads: 24          

       user_api: blas        
   internal_api: openblas    
         prefix: libopenblas                              
       filepath: /home/abhijeet/Code/GMML/.gmml/lib/python3.10/site-packages/scipy.libs/libopenblasp-r0-9f9f5dbc.3.1
8.so                         
        version: 0.3.18      
threading_layer: pthreads    
   architecture: SkylakeX    
    num_threads: 24          

       user_api: openmp      
   internal_api: openmp      
         prefix: libgomp     
       filepath: /home/abhijeet/Code/GMML/.gmml/lib/python3.10/site-packages/torch/lib/libgomp-a34b3233.so.1        
        version: None        
    num_threads: 12
```

COMMENT:
The documentation here confirms that it is a particular kind of estimation of the area under the PR curve (or rather, that the PR curve itself needs to be interpolated between discrete points):

> AP summarizes a precision-recall curve [...]  This implementation is not interpolated and is different from computing the area under the precision-recall curve with the trapezoidal rule, which uses linear interpolation and can be too optimistic.

See also the Notes from the `PrecisionRecallDisplay`:

> The average precision (cf. `average_precision`) in scikit-learn is computed without any interpolation. To be consistent with this metric, the precision-recall curve is plotted without any interpolation as well (step-wise style).

---

As to the behavior, I get 1.0 instead of 0.0 when running your code.  If I make the only class something other than 1 (the default positive class), then I get `NaN` instead.  When the only class is the positive class, I think this is correct: at every threshold (other than the one making no positive predictions, where we just default precision to 1.0) the recall is well-defined and between 0 and 1 while precision is well-defined and exactly 1.  When instead the only class is the negative class, recall has a zero denominator.  I could see making the score raise an error instead of returning `NaN` in this case.  While it seems technically correct to call the score 1 when the only class is the positive one, I can agree that it could lead to misleading results if being aggregated in a cross-validation or such.

Labels: Enhancement, module:metrics