code: def not_raises(ExpectedException):
      """
      A context manager used to check that `ExpectedException` does not occur
      during testing.
      """
  
      try:
          yield
  
      except ExpectedException as error:
          raise AssertionError(
              "Raised exception {} when it should not!".format(error)
          )
  
      except Exception as error:
          raise AssertionError(
              "An unexpected exception {} raised.".format(error)
          )
  
file_path: alibi/alibi/tests/utils.py
imports: from contextlib import contextmanager
  from typing import Optional
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: not_raises(ExpectedException) without return types