code: def test_memory_file_gdal_error_message(capsys):
      """No weird error messages should be seen, see #1659"""
      memfile = MemoryFile()
      data = numpy.array(
          [
              [1, 2, 3, 4],
              [5, 6, 7, 8],
              [9, 10, 11, 12],
              [13, 14, 15, 16],
          ]
      ).astype("uint8")
      west_bound = 0
      north_bound = 2
      cellsize = 0.5
      nodata = -9999
      driver = "AAIGrid"
      dtype = data.dtype
      shape = data.shape
      transform = rasterio.transform.from_origin(
          west_bound, north_bound, cellsize, cellsize
      )
      dataset = memfile.open(
          driver=driver,
          width=shape[1],
          height=shape[0],
          transform=transform,
          count=1,
          dtype=dtype,
          nodata=nodata,
          crs="EPSG:3226",
      )
      dataset.write(data, 1)
      dataset.close()
      captured = capsys.readouterr()
      assert "ERROR 4" not in captured.err
      assert "ERROR 4" not in captured.out
  
imports: from io import BytesIO
  import os.path
  from pathlib import Path
  from affine import Affine
  import numpy
  import pytest
  import rasterio
  from rasterio.io import MemoryFile, ZipMemoryFile
  from rasterio.enums import MaskFlags
  from rasterio.shutil import copyfiles
label_desc: Use image node_id 33 for calling a global function with example usage: test_memory_file_gdal_error_message(capsys) without return types