class_docstr: Tests saving/loading functionality of WithDBSettingsBase class.
class_docstr_tok: ["Tests","saving\/loading","functionality","of","WithDBSettingsBase","class","."]
code: def test_save_experiment(self) -> None:
      experiment = self.get_random_experiment()
      saved = self.with_db_settings._save_experiment_to_db_if_possible(
          experiment
      )
      self.assertTrue(saved)
      loaded_experiment = _load_experiment(
          experiment.name,
          decoder=self.with_db_settings.db_settings.decoder,
      )
      self.assertIsNotNone(loaded_experiment)
      self.assertEqual(experiment, loaded_experiment)
  
imports: import random
  import string
  from typing import Tuple
  from unittest.mock import patch
  from ax.core.base_trial import TrialStatus
  from ax.core.experiment import Experiment
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.service.utils.with_db_settings_base import WithDBSettingsBase
  from ax.storage.sqa_store.db import init_test_engine_and_session_factory
  from ax.storage.sqa_store.load import _load_experiment, _load_generation_strategy_by_experiment_name
  from ax.storage.sqa_store.reduced_state import GR_LARGE_MODEL_ATTRS
  from ax.storage.sqa_store.save import _save_experiment, _save_generation_strategy, _save_or_update_trials
  from ax.storage.sqa_store.structs import DBSettings
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.core_stubs import get_experiment, get_generator_run, SpecialGenerationStrategy
  from ax.utils.testing.modeling_stubs import get_generation_strategy
label_desc: Use image node_id 6 for calling the TestWithDBSettingsBase obj's underlying member method code with example usage: obj.test_save_experiment() without return types