예제 #1
0
def test_checkpoint_callback_file_path_setter():
    new_checkpoint_callback = callback.CheckpointCallback()

    try:
        new_checkpoint_callback.file_path = 1
    except:
        new_checkpoint_callback.file_path = "out"

    assert new_checkpoint_callback.file_path == "out"
예제 #2
0
def test_checkpoint_callback_on_iteration_end():
    new_checkpoint_callback = callback.CheckpointCallback(frequency=1)

    class Model:
        def save(self, file_path):
            pass

    model = Model()

    new_checkpoint_callback.on_iteration_end(1, model)
예제 #3
0
def test_checkpoint_callback_frequency_setter():
    new_checkpoint_callback = callback.CheckpointCallback()

    try:
        new_checkpoint_callback.frequency = "a"
    except:
        new_checkpoint_callback.frequency = 1

    assert new_checkpoint_callback.frequency == 1

    try:
        new_checkpoint_callback.frequency = -1
    except:
        new_checkpoint_callback.frequency = 1

    assert new_checkpoint_callback.frequency == 1
예제 #4
0
def test_checkpoint_callback():
    new_checkpoint_callback = callback.CheckpointCallback()

    assert new_checkpoint_callback.file_path == "checkpoint.pkl"
    assert new_checkpoint_callback.frequency == 0