def METHOD_NAME():
    with mock.patch.object(BatchTimeTracker, "_time_now") as mock_method:
        mock_method.side_effect = [10, 40]
        iterations_to_complete = 3
        tracker = BatchTimeTracker(batches_to_measure=iterations_to_complete)
        stopped = False
        for i in range(iterations_to_complete + 1):
            try:
                tracker.after_batch()
                if i == iterations_to_complete:
                    raise ValueError("CancelFitException should be raised, but was not")
            except CancelFitException:
                stopped = True
        assert stopped
        assert tracker.batch_measured_time == 10.0