code: def test_basic():
      # We always have os
      assert_good("os")
      # Subpackage
      assert_good("os.path")
      # We never have package _not_a_package
      assert_bad("_not_a_package")
  
      # Only disrupt imports for "nottriedbefore" package
      orig_import = builtins.__import__
  
      def raise_Exception(*args, **kwargs):
          if args[0] == "nottriedbefore":
              raise Exception(
                  "non ImportError could be thrown by some malfunctioning module "
                  "upon import, and optional_package should catch it too"
              )
          return orig_import(*args, **kwargs)
  
      with mock.patch.object(
          builtins, "__import__", side_effect=raise_Exception
      ):
          assert_bad("nottriedbefore")
  
file_path: nibabel/nibabel/tests/test_optpkg.py
imports: import builtins
  import sys
  import types
  from unittest import SkipTest, mock
  import pytest
  from packaging.version import Version
  from nibabel.optpkg import optional_package
  from nibabel.tripwire import TripWire, TripWireError
label_desc: Use image node_id 3 for calling a global function with example usage: test_basic() and returns: orig_import