code: def test_eps_and_sparse_error():
      """Check that contingency matrix is not calculated if `eps` is nonzero and `sparse` is True."""
      with pytest.raises(ValueError, match="Cannot specify*"):
          calculate_contingency_matrix(
              _single_dim_inputs.preds,
              _single_dim_inputs.target,
              eps=1e-16,
              sparse=True,
          )
  
file_path: torchmetrics/tests/unittests/clustering/test_utils.py
imports: import numpy
  import pytest
  import torch
  from sklearn.metrics.cluster import contingency_matrix
  from sklearn.metrics.cluster import entropy
  from sklearn.metrics.cluster import pair_confusion_matrix
  from sklearn.metrics.cluster._supervised import _generalized_average
  from torchmetrics.functional.clustering.utils import calculate_contingency_matrix, calculate_entropy, calculate_generalized_mean, calculate_pair_cluster_confusion_matrix
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
label_desc: Use image node_id 1 for calling a global function with example usage: test_eps_and_sparse_error() without return types