'Verifies the computed grades are as expected.'

def _verify_grades(self, raw_earned, raw_possible, weight, expected_score):

    with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred):
        for problem in self.problems:
            problem.weight = weight
            self.store.update_item(problem, self.user.id)
        self.store.publish(self.course.location, self.user.id)
    course_structure = get_course_blocks(self.request.user, self.course.location)
    for problem in self.problems:
        answer_problem(self.course, self.request, problem, score=raw_earned, max_value=raw_possible)
    subsection_grade = SubsectionGradeFactory(self.request.user, self.course, course_structure).update(self.sequential)
    for problem in self.problems:
        problem_score = subsection_grade.problem_scores[problem.location]
        self.assertEqual(type(expected_score.first_attempted), type(problem_score.first_attempted))
        expected_score.first_attempted = problem_score.first_attempted
        self.assertEquals(problem_score, expected_score)
    self.assertEquals(subsection_grade.all_total.earned, (expected_score.earned * len(self.problems)))
    self.assertEquals(subsection_grade.all_total.possible, (expected_score.possible * len(self.problems)))
