def METHOD_NAME(tmp_path):
    test_model_filepath = str(tmp_path / "test_model.{epoch:02d}.h5")
    moving_avg = MovingAverage(get_legacy_sgd(2.0), average_decay=0.5)
    optimizer = tf.keras.mixed_precision.LossScaleOptimizer(moving_avg)
    x, y, model = get_data_and_model(optimizer)
    save_freq = "epoch"
    avg_model_ckpt = AverageModelCheckpoint(
        update_weights=False, filepath=test_model_filepath, save_freq=save_freq
    )
    model.fit(
        x,
        y,
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
        validation_data=(x, y),
        callbacks=[avg_model_ckpt],
    )
    assert not os.path.exists(test_model_filepath)