class_docstr: Test the import_optional function.
docstr: Test import_optional correctly replaces names from module that doesn't exist with MissingDependencies.
code: def test_import_optional_names_missing(self):
      """Test import_optional correctly replaces names from module that doesn't exist with MissingDependencies."""
      (
          MockedClassWithoutRequiredDeps,
          mocked_function_without_required_deps,
      ) = import_optional(
          "alibi.utils.tests.mocked_opt_dep",
          names=[
              "MockedClassWithoutRequiredDeps",
              "mocked_function_without_required_deps",
          ],
      )
      assert isinstance(
          MockedClassWithoutRequiredDeps, MissingDependency
      )
      with pytest.raises(ImportError) as err:
          MockedClassWithoutRequiredDeps.__version__  # noqa
      assert "MockedClassWithoutRequiredDeps" in str(err.value)
      assert "pip install alibi[optional-deps]" in str(err.value)
  
      assert isinstance(
          mocked_function_without_required_deps, MissingDependency
      )
      with pytest.raises(ImportError) as err:
          mocked_function_without_required_deps.__version__  # noqa
      assert "mocked_function_without_required_deps" in str(err.value)
      assert "pip install alibi[optional-deps]" in str(err.value)
  
file_path: alibi/alibi/utils/tests/test_import_optional.py
imports: import pytest
  from alibi.utils.missing_optional_dependency import import_optional, ERROR_TYPES, MissingDependency
label_desc: Use image node_id 6 for calling the TestImportOptional obj's underlying member method code with example usage: obj.test_import_optional_names_missing() without return types