def test_set_score(self, grade_adjust, expected_passed_value, expected_grade_str): """Tests that the set_score helper method sets score-related fields appropriately""" passing_score = 60.0 grade = ProctoredExamGradeFactory.build( passing_score=passing_score, score=None, percentage_grade=None, passed=None, ) grade.set_score(passing_score + grade_adjust) assert grade.score == passing_score + grade_adjust assert grade.percentage_grade == grade.score / 100.0 assert grade.passed == expected_passed_value assert grade.grade == expected_grade_str
def test_set_score_none(self): """Tests that set_score fails if the provided score is None""" grade = ProctoredExamGradeFactory.build() with self.assertRaises(TypeError): grade.set_score(None)