コード例 #1
0
def test_measure_loop_end(_, __, ___, ____, _____, ______, experiment_config,
                          db_experiment):
    """Tests that measure_loop stops when there is nothing left to measure. In
    this test, there is nothing left to measure on the first call."""

    measure_manager.measure_loop(
        experiment_config, 100,
        detailed_coverage_data_utils.DetailedCoverageData())
コード例 #2
0
def test_measure_loop_loop_until_end(mocked_measure_all_trials, _, __, ___,
                                     ____, _____, experiment_config,
                                     db_experiment):
    """Test that measure loop will stop measuring when all trials have ended. In
    this test, there is more to measure for a few iterations, then the mocked
    functions will indicate that there is nothing left to measure."""
    call_count = 0
    # Scheduler is running.
    loop_iterations = 6

    def mock_measure_all_trials(*args, **kwargs):
        # Do the assertions here so that there will be an assert fail on failure
        # instead of an infinite loop.
        nonlocal call_count
        call_count += 1
        if call_count >= loop_iterations:
            return False
        return True

    mocked_measure_all_trials.side_effect = mock_measure_all_trials
    measure_manager.measure_loop(experiment_config, 100)
    assert call_count == loop_iterations
コード例 #3
0
def test_measure_loop_end(_, __, ___, ____, _____, ______, experiment_config,
                          db_experiment):
    """Tests that measure_loop stops when there is nothing left to measure. In
    this test, there is nothing left to measure on the first call."""
    measure_manager.measure_loop(experiment_config, 100)