code: def test_rouge_metric_raises_errors_and_warnings():
      """Test that expected warnings and errors are raised."""
      if not _NLTK_AVAILABLE:
          with pytest.raises(
              ModuleNotFoundError,
              match="ROUGE metric requires that `nltk` is installed."
              " Either as `pip install torchmetrics[text]` or `pip install nltk`.",
          ):
              ROUGEScore()
  
imports: import re
  from functools import partial
  from typing import Callable, Sequence, Union
  import pytest
  import torch
  from torch import Tensor
  from torchmetrics.functional.text.rouge import rouge_score
  from torchmetrics.text.rouge import ROUGEScore
  from torchmetrics.utilities.imports import _NLTK_AVAILABLE, _ROUGE_SCORE_AVAILABLE
  from typing_extensions import Literal
  from unittests.text.helpers import TextTester, skip_on_connection_issues
  from unittests.text.inputs import _Input, _inputs_multiple_references, _inputs_single_sentence_single_reference
label_desc: Use image node_id 2 for calling a global function with example usage: test_rouge_metric_raises_errors_and_warnings() without return types