code: def test_comet_logger_no_api_key_given(comet_mock):
      """Test that CometLogger fails to initialize if both api key and save_dir are missing."""
      with pytest.raises(
          MisconfigurationException,
          match="requires either api_key or save_dir",
      ):
          comet_mock.config.get_api_key.return_value = None
          CometLogger(workspace="dummy-test", project_name="general")
  
imports: import os
  from unittest import mock
  from unittest.mock import DEFAULT, Mock, patch
  import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers import CometLogger
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import tensor
label_desc: Use image node_id 3 for calling a global function with example usage: test_comet_logger_no_api_key_given(comet_mock) without return types