code: def test_context(tmpdir):
      name = Path(str(tmpdir.join("test_context.tif"))).as_posix()
      with rasterio.open(
          name,
          "w",
          driver="GTiff",
          width=100,
          height=100,
          count=1,
          dtype=rasterio.ubyte,
      ) as s:
          assert s.name == name
          assert s.driver == "GTiff"
          assert not s.closed
          assert s.count == 1
          assert s.width == 100
          assert s.height == 100
          assert s.shape == (100, 100)
          assert s.indexes == (1,)
          assert (
              repr(s)
              == "<open DatasetWriter name='%s' mode='w'>" % name
          )
      assert s.closed
      assert s.count == 1
      assert s.width == 100
      assert s.height == 100
      assert s.shape == (100, 100)
      assert (
          repr(s) == "<closed DatasetWriter name='%s' mode='w'>" % name
      )
      info = subprocess.check_output(["gdalinfo", name]).decode("utf-8")
      assert "GTiff" in info
      assert "Size is 100, 100" in info
      assert "Band 1 Block=100x81 Type=Byte, ColorInterp=Gray" in info
  
imports: import logging
  import re
  from pathlib import Path
  import subprocess
  import affine
  import numpy
  import pytest
  from .conftest import requires_gdal35, gdal_version
  import rasterio
  from rasterio.drivers import blacklist
  from rasterio.enums import MaskFlags, Resampling
  from rasterio.env import Env, GDALVersion
  from rasterio.errors import RasterioIOError
label_desc: Use image node_id 6 for calling a global function with example usage: test_context(tmpdir) without return types