当前位置: 首页>>代码示例>>Python>>正文


Python test_util.get_sub函数代码示例

本文整理汇总了Python中test_util.get_sub函数的典型用法代码示例。如果您正苦于以下问题:Python get_sub函数的具体用法?Python get_sub怎么用?Python get_sub使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_sub函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_single_peer_grading_item

    def test_get_single_peer_grading_item(self):
        for i in xrange(0,settings.MIN_TO_USE_PEER):
            test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
            test_sub.save()
            handle_submission(test_sub)
            test_grader = test_util.get_grader("IN")
            test_grader.submission=test_sub
            test_grader.save()

            test_sub.state = SubmissionState.finished
            test_sub.previous_grader_type = "IN"
            test_sub.posted_results_back_to_queue = True
            test_sub.save()

        test_sub = test_util.get_sub("PE", ALTERNATE_STUDENT, LOCATION, "PE")
        test_sub.save()
        handle_submission(test_sub)
        test_sub.is_duplicate = False
        test_sub.save()

        pl = peer_grading_util.PeerLocation(LOCATION, STUDENT_ID)
        found, grading_item = pl.next_item()
        self.assertEqual(found, True)

        pl = peer_grading_util.PeerLocation(LOCATION,"1")
        subs_graded = pl.graded()
开发者ID:Neodemia,项目名称:edx-ora,代码行数:26,代码来源:tests.py

示例2: test_get_next_submission_true

    def test_get_next_submission_true(self):
        test_sub = test_util.get_sub("PE", "1", LOCATION, "PE")
        test_sub.save()
        grader = test_util.get_grader("BC")
        grader.submission = test_sub
        grader.grader_id = "2"
        grader.save()

        for i in xrange(0,settings.MIN_TO_USE_PEER):
            test_sub = test_util.get_sub("PE", "1", LOCATION, "PE")
            test_sub.save()
            grader = test_util.get_grader("IN")
            grader.submission = test_sub
            grader.save()

        test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub.save()
        content = self.c.get(
            GET_NEXT,
            data={'grader_id' : STUDENT_ID, "location" : LOCATION},
            )

        body = json.loads(content.content)

        self.assertEqual(body['success'], True)
开发者ID:Neodemia,项目名称:edx-ora,代码行数:25,代码来源:tests.py

示例3: test_get_next_submission_true

    def test_get_next_submission_true(self):
        test_sub = test_util.get_sub("PE", "1", LOCATION, "PE")
        test_sub.save()
        grader = test_util.get_grader("BC")
        grader.submission = test_sub
        grader.grader_id = "2"
        grader.save()

        pl = peer_grading_util.PeerLocation(LOCATION, "1")
        control = SubmissionControl(pl.latest_submission())

        for i in xrange(0, control.minimum_to_use_peer):
            test_sub = test_util.get_sub("PE", "1", LOCATION, "PE")
            test_sub.save()
            grader = test_util.get_grader("IN")
            grader.submission = test_sub
            grader.save()

        test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub.save()
        content = self.c.get(
            GET_NEXT,
            data={'grader_id' : STUDENT_ID, "location" : LOCATION},
            )

        body = json.loads(content.content)

        self.assertEqual(body['success'], True)
开发者ID:EDUlib,项目名称:edx-ora,代码行数:28,代码来源:tests.py

示例4: test_submission_location

    def test_submission_location(self):
        Submission.objects.all().delete()
        test_sub=test_util.get_sub("IN",STUDENT_ID, LOCATION)
        test_sub.save()

        test_sub2=test_util.get_sub("PE",STUDENT_ID, LOCATION)
        test_sub2.state = SubmissionState.finished
        test_sub2.previous_grader_type = "PE"
        test_sub2.save()

        test_grader_in=test_util.get_grader("IN")
        test_grader_in.submission=test_sub2
        test_grader_in.save()

        test_grader_pe=test_util.get_grader("PE")
        test_grader_pe.submission=test_sub2
        test_grader_pe.save()


        sl = StaffLocation(LOCATION)
        self.assertEqual(sl.location_submissions().count(),2)
        self.assertEqual(sl.all_pending_count(),1)
        self.assertEqual(sl.graded_count(),1)
        self.assertEqual(sl.pending_count(),1)
        self.assertEqual(len(sl.graded_submission_text()),1)
        test_sub2.delete()
        next_item_id = sl.item_to_score()[1]
        self.assertEqual(next_item_id ,test_sub.id)

        test_sub = Submission.objects.get(id=next_item_id)
        self.assertEqual(test_sub.state,SubmissionState.being_graded)
        test_sub.state = SubmissionState.waiting_to_be_graded
        test_sub.save()
        self.assertEqual(sl.next_item()[1],test_sub.id)
开发者ID:agamdua,项目名称:edx-ora,代码行数:34,代码来源:tests.py

示例5: test_check_name_uniqueness

 def test_check_name_uniqueness(self):
     success, name_unique = grader_util.check_name_uniqueness("temp", LOCATION, "course_id")
     self.assertTrue(name_unique)
     test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
     test_sub.save()
     test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION + "1", "PE")
     test_sub.save()
     success, name_unique = grader_util.check_name_uniqueness("id", LOCATION, "course_id")
     self.assertFalse(name_unique)
开发者ID:EduPepperPDTesting,项目名称:ora,代码行数:9,代码来源:tests.py

示例6: test_get_next_get_finished_subs

    def test_get_next_get_finished_subs(self):
        Submission.objects.all().delete()
        all_students = [STUDENT_ID, ALTERNATE_STUDENT, STUDENT3]
        # setup 3 submissions from 3 students, passed basic check
        submissions = []
        for student in all_students:
            test_sub = test_util.get_sub("PE", student, LOCATION, preferred_grader_type="PE")
            test_sub.next_grader_type="PE"
            test_sub.is_duplicate=False
            test_sub.save()
            submissions.append(test_sub)
            bc_grader = test_util.get_grader("BC")
            bc_grader.submission = test_sub
            bc_grader.save()

        # have them each grade the other two and call that finished
        for student in all_students:
            for submission in Submission.objects.all().exclude(student_id=student):
                test_grader = test_util.get_grader("PE")
                test_grader.grader_id = student
                test_grader.submission = submission
                test_grader.save()
        for sub in submissions:
            sub.state = SubmissionState.finished
            sub.posted_results_back_to_queue = True
            sub.save()

        pls = []
        for student in all_students:
            pls.append(peer_grading_util.PeerLocation(LOCATION, student))

        # check that each student graded 2, and so no submissions are pending
        for pl in pls:
            self.assertEqual(pl.graded_count(),2)
            self.assertEqual(pl.pending_count(),0)
            # check that next_item() cannot returns a submission because each of these students
            # has graded the submissions by the other 2 students
            found, _ = pl.next_item()
            self.assertFalse(found)

        # now a 4th student comes along and submits.  They should get something to grade despite nothing pending
        student4 = "10"
        test_sub = test_util.get_sub("PE", student4, LOCATION, preferred_grader_type="PE")
        test_sub.next_grader_type="PE"
        test_sub.is_duplicate=False
        test_sub.control_fields=json.dumps({'peer_grade_finished_submissions_when_none_pending': True})
        test_sub.save()

        pl4 = peer_grading_util.PeerLocation(LOCATION, student4)
        self.assertEqual(pl4.pending_count(),0)
        found, next_sub_id = pl4.next_item()
        self.assertTrue(found)
        student4_sub_to_grade = Submission.objects.get(id=next_sub_id)
        self.assertIn(student4_sub_to_grade, submissions)
        self.assertEqual(student4_sub_to_grade.state, SubmissionState.being_graded)
开发者ID:Neodemia,项目名称:edx-ora,代码行数:55,代码来源:tests.py

示例7: test_get_required

    def test_get_required(self):
        pl = peer_grading_util.PeerLocation(LOCATION, STUDENT_ID)
        student_required = pl.required_count()
        test_sub = test_util.get_sub("PE", ALTERNATE_STUDENT, LOCATION, "PE")
        test_sub.save()

        self.assertEqual(pl.required_count(), student_required)

        test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub.save()

        self.assertEqual(pl.required_count(), settings.REQUIRED_PEER_GRADING_PER_STUDENT + student_required)
开发者ID:Neodemia,项目名称:edx-ora,代码行数:12,代码来源:tests.py

示例8: test_check_if_grading_finished_for_duplicates

    def test_check_if_grading_finished_for_duplicates(self):
        test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub.save()
        handle_submission(test_sub)

        sl = StaffLocation(LOCATION)
        control = SubmissionControl(sl.latest_submission())

        for i in xrange(0, control.minimum_to_use_peer):
            test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
            test_sub.save()
            handle_submission(test_sub)
            test_grader = test_util.get_grader("IN")
            test_grader.submission=test_sub
            test_grader.save()

            test_sub.state = SubmissionState.finished
            test_sub.previous_grader_type = "IN"
            test_sub.posted_results_back_to_queue = True
            test_sub.save()

        test_sub2 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub2.save()
        handle_submission(test_sub2)
        self.assertTrue(test_sub2.is_duplicate)

        success = expire_submissions.check_if_grading_finished_for_duplicates()
        self.assertEqual(success, True)
        test_sub2.is_duplicate = False
        test_sub2.save()

        test_sub3 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub3.is_duplicate = False
        test_sub3.save()

        self.assertEqual(test_sub3.is_duplicate, False)
        test_sub3.has_been_duplicate_checked = False
        test_sub3.save()
        expire_submissions.mark_student_duplicate_submissions()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertEqual(test_sub3.is_duplicate,True)

        test_sub3.duplicate_submission_id = None
        test_sub3.is_plagiarized = False
        test_sub3.save()
        expire_submissions.add_in_duplicate_ids()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertTrue(test_sub3.duplicate_submission_id is not None)
开发者ID:EduPepperPDTesting,项目名称:ora,代码行数:48,代码来源:tests.py

示例9: test_put_result

    def test_put_result(self):
        sub = test_util.get_sub("IN",STUDENT_ID,LOCATION)
        sub.save()
        post_dict={
            'feedback': "test feedback",
            'submission_id' : 1 ,
            'grader_type' : "ML" ,
            'status' : "S",
            'confidence' : 1,
            'grader_id' : 1,
            'score' : 1,
            'errors' : "test",
            "rubric_scores_complete" : True,
            "rubric_scores" : json.dumps([1,1]),
            }

        content = self.c.post(
            PUT_URL,
            post_dict,
        )

        body=json.loads(content.content)

        return_code=body['success']

        #Male sure that function returns true
        self.assertEqual(return_code,True)

        sub=Submission.objects.get(id=1)
        successful_grader_count=sub.get_successful_graders().count()

        #Make sure that grader object is actually created!
        self.assertEqual(successful_grader_count,1)
开发者ID:EduPepperPDTesting,项目名称:ora,代码行数:33,代码来源:tests.py

示例10: _message_submission

    def _message_submission(self, success, score=None, submission_id=None):
        sub = test_util.get_sub("IN",STUDENT_ID,LOCATION)
        sub.save()
        grade=test_util.get_grader("IN")
        grade.submission=sub
        grade.save()
        grader_id = grade.grader_id
        if submission_id is None:
            submission_id = sub.id

        message = {
            'grader_id': grader_id,
            'submission_id': submission_id,
            'feedback': "This is test feedback",
            'student_info': test_util.get_student_info(STUDENT_ID),
        }
        if score is not None:
            message['score'] = score
        
        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(message),
        }
        content = self.c.post(
                SUBMIT_MESSAGE_URL,
                content
        )
        body = json.loads(content.content)
        self.assertEqual(body['success'], success)
开发者ID:EduPepperPDTesting,项目名称:ora,代码行数:29,代码来源:tests.py

示例11: test_get_submissions_that_have_expired

    def test_get_submissions_that_have_expired(self):
        test_sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub.save()

        expired_submissions = expire_submissions.get_submissions_that_have_expired(Submission.objects.all())

        self.assertEqual(len(expired_submissions),1)
开发者ID:qimi2008,项目名称:edx-ora,代码行数:7,代码来源:tests.py

示例12: test_save_grade_with_no_rubrics_and_submission_unknown

    def test_save_grade_with_no_rubrics_and_submission_unknown(self):
        """
        Test save grade when submission is mark as unknown and rubric score are not provided.
        """

        test_sub = test_util.get_sub("PE", "blah", LOCATION, "PE")
        test_sub.save()

        test_dict = {
            'location': LOCATION,
            'grader_id': STUDENT_ID,
            'submission_id': 1,
            'score': 5,
            'feedback': 'feedback',
            'submission_key': 'string',
            'submission_flagged': False,
            'answer_unknown': True,
            'rubric_scores_complete': False,
            'rubric_scores': [],
            }

        content = self.c.post(
            SAVE_GRADE,
            test_dict,
        )

        body = json.loads(content.content)
        #Should succeed, as we created a submission above that save_grade can use
        self.assertEqual(body["success"], True)

        sub = Submission.objects.get(id=1)

        #Score should be 0.
        self.assertEqual(sub.get_last_grader().score, 0)
开发者ID:EDUlib,项目名称:edx-ora,代码行数:34,代码来源:tests.py

示例13: test_get_problems_student_has_tried

 def test_get_problems_student_has_tried(self):
     success, sub_list = grader_util.get_problems_student_has_tried(STUDENT_ID, "course_id")
     self.assertTrue(isinstance(sub_list, list))
     test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
     test_sub.save()
     success, sub_list = grader_util.get_problems_student_has_tried(STUDENT_ID, "course_id")
     self.assertTrue(len(sub_list)>0)
开发者ID:EduPepperPDTesting,项目名称:ora,代码行数:7,代码来源:tests.py

示例14: test_skip_problem_next_grader_type_ml

 def test_skip_problem_next_grader_type_ml(self):
     """Next grader type should be ML."""
     test_sub = test_util.get_sub("IN", LOCATION, STUDENT_ID, course_id=COURSE_ID, preferred_grader_type="ML")
     test_sub.save()
     self.save_grade(True, True)
     test_sub = Submission.objects.get(id=test_sub.id)
     self.assertEqual(test_sub.next_grader_type, "ML")
开发者ID:EDUlib,项目名称:edx-ora,代码行数:7,代码来源:tests.py

示例15: test_is_calibrated_false

    def test_is_calibrated_false(self):

        content = self.c.get(
            IS_CALIBRATED,
            data=self.get_data,
        )

        body=json.loads(content.content)

        #No records exist for given problem_id, so calibration check should fail and return an error
        self.assertEqual(body['success'], False)


        sub=test_util.get_sub("IN",STUDENT_ID,LOCATION)
        sub.save()

        content = self.c.get(
            IS_CALIBRATED,
            data=self.get_data,
        )

        body=json.loads(content.content)

        #Now one record exists for given problem_id, so calibration check should return False (student is not calibrated)
        self.assertEqual(body['calibrated'], False)
开发者ID:Neodemia,项目名称:edx-ora,代码行数:25,代码来源:tests.py


注:本文中的test_util.get_sub函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。