code: def test_grab_simulated():
      # Hard to test for real, if only because its only fully suppored on
      # Windows, but we can monkey patch so we can test all the imageio bits.
  
      imageio.plugins.grab.BaseGrabFormat._ImageGrab = FakeImageGrab
      imageio.plugins.grab.BaseGrabFormat._pillow_imported = True
      _plat = sys.platform
      sys.platform = "win32"
  
      try:
          im = iio.imread("<screen>")
          assert im.shape == (8, 8, 3)
  
          reader = iio.get_reader("<screen>")
          im1 = reader.get_data(0)
          im2 = reader.get_data(0)
          im3 = reader.get_data(1)
          assert im1.shape == (8, 8, 3)
          assert im2.shape == (8, 8, 3)
          assert im3.shape == (8, 8, 3)
  
          im = iio.imread("<clipboard>")
          assert im.shape == (9, 9, 3)
  
          reader = iio.get_reader("<clipboard>")
          im1 = reader.get_data(0)
          im2 = reader.get_data(0)
          im3 = reader.get_data(1)
          assert im1.shape == (9, 9, 3)
          assert im2.shape == (9, 9, 3)
          assert im3.shape == (9, 9, 3)
  
          # Grabbing from clipboard can fail if there is no image data to grab
          FakeImageGrab.has_clipboard = False
          with raises(RuntimeError):
              im = iio.imread("<clipboard>")
  
      finally:
          sys.platform = _plat
          imageio.plugins.grab.BaseGrabFormat._ImageGrab = None
          imageio.plugins.grab.BaseGrabFormat._pillow_imported = False
          FakeImageGrab.has_clipboard = True
  
file_path: imageio/tests/test_grab.py
imports: import sys
  import numpy
  from pytest import raises
  import imageio.v2
  import imageio.plugins.grab
label_desc: Use image node_id 2 for calling a global function with example usage: test_grab_simulated() without return types