def test_model_training():
    train, validation = dataset_preparation()

    # TODO : Modify the Model to improve performances !
    model = Models.create(input_shape=(28, 28, 1), num_classes=10)
    Models.print_model_summary(model)
    Models.train(model, train, validation)
    Models.save_model(model, './my_model')

    # evaluate the model
    scores = model.evaluate_generator(validation,
                                      steps=validation.n,
                                      verbose=0)

    accuracy_percentage = scores[1] * 100
    print("evaluation on unseen dataset : {} = {}".format(
        model.metrics_names[1], accuracy_percentage))

    # TODO : add batch normalization to Models.create_model() to gain some accuracy
    # https://keras.io/layers/normalization/
    assert accuracy_percentage >= 50, "Bad accuracy ({}%) : {}".format(
        accuracy_percentage, "something is wrong :(")
def test_create_model():
    model = Models.create(input_shape=(28, 28, 1), num_classes=10)
    Models.save_model(model, model_path)

    assert os.path.exists(os.path.join(model_path, 'model.h5'))