def _assert_workflow_status(self, submission_uuid, num_completed, num_required):
        """
        Check that the training workflow is on the expected step.

        Args:
            submission_uuid (str): Submission UUID of the student being trained.
            num_completed (int): The expected number of examples assessed correctly.
            num_total (int): The required number of examples to assess.

        Returns:
            None

        Raises:
            AssertionError

        """
        # Check the number of steps we've completed
        actual_num_completed = training_api.get_num_completed(submission_uuid)
        self.assertEqual(actual_num_completed, num_completed)

        # Check whether the assessment step is completed
        # (used by the workflow API)
        requirements = {'num_required': num_required}
        is_finished = training_api.submitter_is_finished(submission_uuid, requirements)
        self.assertEqual(is_finished, bool(num_completed >= num_required))

        # Assessment is finished should always be true,
        # since we're not being assessed by others.
        self.assertTrue(training_api.assessment_is_finished(submission_uuid, requirements))

        # At no point should we receive a score!
        self.assertIs(training_api.get_score(submission_uuid, requirements), None)
    def test_is_finished_no_workflow(self):
        # Without creating a workflow, we should not be finished
        requirements = {'num_required': 1}
        self.assertFalse(training_api.submitter_is_finished(self.submission_uuid, requirements))

        # But since we're not being assessed by others, the "assessment" should be finished.
        self.assertTrue(training_api.assessment_is_finished(self.submission_uuid, requirements))
예제 #3
0
    def test_is_finished_no_workflow(self):
        # Without creating a workflow, we should not be finished
        requirements = {'num_required': 1}
        self.assertFalse(
            training_api.submitter_is_finished(self.submission_uuid,
                                               requirements))

        # But since we're not being assessed by others, the "assessment" should be finished.
        self.assertTrue(
            training_api.assessment_is_finished(self.submission_uuid,
                                                requirements))
예제 #4
0
    def _assert_workflow_status(self, submission_uuid, num_completed,
                                num_required):
        """
        Check that the training workflow is on the expected step.

        Args:
            submission_uuid (str): Submission UUID of the student being trained.
            num_completed (int): The expected number of examples assessed correctly.
            num_total (int): The required number of examples to assess.

        Returns:
            None

        Raises:
            AssertionError

        """
        # Check the number of steps we've completed
        actual_num_completed = training_api.get_num_completed(submission_uuid)
        self.assertEqual(actual_num_completed, num_completed)

        # Check whether the assessment step is completed
        # (used by the workflow API)
        requirements = {'num_required': num_required}
        is_finished = training_api.submitter_is_finished(
            submission_uuid, requirements)
        self.assertEqual(is_finished, bool(num_completed >= num_required))

        # Assessment is finished should always be true,
        # since we're not being assessed by others.
        self.assertTrue(
            training_api.assessment_is_finished(submission_uuid, requirements))

        # At no point should we receive a score!
        self.assertIs(training_api.get_score(submission_uuid, requirements),
                      None)