def METHOD_NAME(*args, **kwargs):  # pylint: disable=unused-argument
  """Simulates an Independent Worker inside a thread."""
  # TODO(rchao): Refactor to abstract the common boilerplate out.
  with test.mock.patch.object(dc, '_run_std_server',
                              self._make_mock_run_std_server()):
    model = get_simple_bias_model()
    initial_weights = model.get_weights()
    def _get_model_results(optimizer, initial_weights):
      # Clear Keras session to reset device assignment
      keras.backend._SESSION.session = None
      strategy = strategy_cls()
      with strategy.scope():
        train_ds = get_input_datasets()
        model = get_simple_bias_model()
        model.set_weights(initial_weights)
        model.compile(loss='mae', optimizer=optimizer, metrics=['mae'])
      return {
          'trained_loss_and_accuracy':
              model.fit(x=train_ds, epochs=20).history,
          'trained_weights':
              model.get_weights(),
      }
    results1 = _get_model_results(optimizer_class_1(0.01), initial_weights)
    results2 = _get_model_results(optimizer_class_2(0.01), initial_weights)
    for key in results1:
      self.assertAllClose(
          results1[key],
          results2[key],
          atol=1e-5,
          rtol=1e-5,
          msg='Fail to assert {}'.format(key))