code: def test_compatibility_with_some_opts_only(tmp_path):
      test_model_filepath = str(tmp_path / "test_model.h5")
      x, y, model = get_data_and_model(optimizer="rmsprop")
      avg_model_ckpt = AverageModelCheckpoint(
          update_weights=True, filepath=test_model_filepath
      )
      with pytest.raises(
          TypeError,
          match="AverageModelCheckpoint is only used when trainingwith"
          " MovingAverage or StochasticAverage",
      ):
          model.fit(
              x,
              y,
              epochs=EPOCHS,
              batch_size=BATCH_SIZE,
              callbacks=[avg_model_ckpt],
          )
  
file_path: addons/tensorflow_addons/callbacks/tests/avg_model_checkpoint_test.py
imports: import os
  import pytest
  import tensorflow
  from tensorflow import keras
  from tensorflow_addons.callbacks import AverageModelCheckpoint
  from tensorflow_addons.optimizers import MovingAverage
label_desc: Use image node_id 3 for calling a global function with example usage: test_compatibility_with_some_opts_only(tmp_path) without return types