@contextmanager
def mock_get_submissions_score(earned=0, possible=1, attempted=True):
 with patch('lms.djangoapps.grades.scores._get_score_from_submissions') as mock_score:
  mock_score.return_value = (earned, possible, earned, possible, attempted)
  (yield mock_score)

@ contextmanager def mock_get_submissions_score ( earned = 0 , possible = 1 , attempted = True ) : with patch ( 'lms.djangoapps.grades.scores._get_score_from_submissions' ) as mock_score : mock_score . return_value = ( earned , possible , earned , possible , attempted ) ( yield mock_score )
mocks the _get_submissions_score function to return the specified values .