def METHOD_NAME(tmp_path):
    test_model_filepath = str(tmp_path / "test_model.h5")
    x, y, model = get_data_and_model()
    save_best_only = True
    avg_model_ckpt = AverageModelCheckpoint(
        update_weights=True, filepath=test_model_filepath, save_best_only=save_best_only
    )
    model.fit(
        x,
        y,
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
        validation_data=(x, y),
        callbacks=[avg_model_ckpt],
    )
    assert os.path.exists(test_model_filepath)