class_docstr: Tests saving/loading functionality of WithDBSettingsBase class.
class_docstr_tok: ["Tests","saving\/loading","functionality","of","WithDBSettingsBase","class","."]
code: def test_update_generation_strategy_mini_batches(self) -> None:
      (
          _,
          generation_strategy,
      ) = self.init_experiment_and_generation_strategy()
  
      # Check with 1 GR.
      generator_run = get_generator_run()
      self.assertIsNone(generator_run.db_id)
      updated = self.with_db_settings._update_generation_strategy_in_db_if_possible(
          generation_strategy, [generator_run]
      )
      self.assertTrue(updated)
      self.assertIsNotNone(generator_run.db_id)
  
      # Check with multiple GRs, where their number % mini batch size is not 0.
      grs = [generator_run.clone() for _ in range(5)]
      for gr in grs:
          self.assertIsNone(gr._db_id)
      updated = self.with_db_settings._update_generation_strategy_in_db_if_possible(
          generation_strategy, grs
      )
      self.assertTrue(updated)
      for gr in grs:
          self.assertIsNotNone(gr.db_id)
  
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 12 for calling the TestWithDBSettingsBase obj's underlying member method code with example usage: obj.test_update_generation_strategy_mini_batches() without return types