code: def test_read_w_mode_warning(tmpdir):
      """Get an UnsupportedOperation exception reading from dataset opened in "w" mode"""
      path = tmpdir.join("test.tif")
      profile = DefaultGTiffProfile(count=1, width=300, height=300)
  
      with rasterio.open(str(path), "w", **profile) as dst:
          dst.write(255 * np.ones((1, 300, 300), dtype="uint8"))
  
          with pytest.raises(UnsupportedOperation):
              assert (dst.read() == 255).all()
  
file_path: rasterio/tests/test_dataset_rw.py
imports: import numpy
  import pytest
  import rasterio
  from rasterio.errors import UnsupportedOperation
  from rasterio.profiles import DefaultGTiffProfile
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: test_read_w_mode_warning(tmpdir) without return types