code: def test_statistics_all_invalid(capsys):
      """Raise an exception for stats of an invalid dataset."""
      with rasterio.open("tests/data/all-nodata.tif") as dataset:
          with pytest.raises(RasterioError):
              _ = dataset.statistics(1)
  
      captured = capsys.readouterr()
      assert "ERROR 1" not in captured.err
  
imports: from numpy.testing import assert_almost_equal
  import pytest
  import rasterio
  from rasterio.errors import RasterioError
label_desc: Use image node_id 2 for calling a global function with example usage: test_statistics_all_invalid(capsys) without return types