當前位置: 首頁>>代碼示例>>Python>>正文


Python OpenEndedChild.record_latest_post_assessment方法代碼示例

本文整理匯總了Python中xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild.record_latest_post_assessment方法的典型用法代碼示例。如果您正苦於以下問題:Python OpenEndedChild.record_latest_post_assessment方法的具體用法?Python OpenEndedChild.record_latest_post_assessment怎麽用?Python OpenEndedChild.record_latest_post_assessment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild的用法示例。


在下文中一共展示了OpenEndedChild.record_latest_post_assessment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OpenEndedChildTest

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import record_latest_post_assessment [as 別名]
class OpenEndedChildTest(unittest.TestCase):
    """
    Test the open ended child class
    """
    location = Location(["i4x", "edX", "sa_test", "selfassessment",
                         "SampleQuestion"])

    metadata = json.dumps({'attempts': '10'})
    prompt = etree.XML("<prompt>This is a question prompt</prompt>")
    rubric = '''<rubric><rubric>
        <category>
        <description>Response Quality</description>
        <option>The response is not a satisfactory answer to the question.  It either fails to address the question or does so in a limited way, with no evidence of higher-order thinking.</option>
        <option>Second option</option>
        </category>
         </rubric></rubric>'''
    max_score = 1

    static_data = {
        'max_attempts': 20,
        'prompt': prompt,
        'rubric': rubric,
        'max_score': max_score,
        'display_name': 'Name',
        'accept_file_upload': False,
        'close_date': None,
        's3_interface': "",
        'open_ended_grading_interface': {},
        'skip_basic_checks': False,
        'control': {
            'required_peer_grading': 1,
            'peer_grader_count': 1,
            'min_to_calibrate': 3,
            'max_to_calibrate': 6,
            'peer_grade_finished_submissions_when_none_pending': False,
        }
    }
    definition = Mock()
    descriptor = Mock()

    def setUp(self):
        self.test_system = get_test_system()
        self.test_system.open_ended_grading_interface = None
        self.openendedchild = OpenEndedChild(self.test_system, self.location,
                                             self.definition, self.descriptor, self.static_data, self.metadata)

    def test_latest_answer_empty(self):
        answer = self.openendedchild.latest_answer()
        self.assertEqual(answer, "")

    def test_latest_score_empty(self):
        answer = self.openendedchild.latest_score()
        self.assertEqual(answer, None)

    def test_latest_post_assessment_empty(self):
        answer = self.openendedchild.latest_post_assessment(self.test_system)
        self.assertEqual(answer, "")

    def test_new_history_entry(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)
        answer = self.openendedchild.latest_answer()
        self.assertEqual(answer, new_answer)

        new_answer = "Newer Answer"
        self.openendedchild.new_history_entry(new_answer)
        answer = self.openendedchild.latest_answer()
        self.assertEqual(new_answer, answer)

    def test_record_latest_score(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)
        new_score = 3
        self.openendedchild.record_latest_score(new_score)
        score = self.openendedchild.latest_score()
        self.assertEqual(score, 3)

        new_score = 4
        self.openendedchild.new_history_entry(new_answer)
        self.openendedchild.record_latest_score(new_score)
        score = self.openendedchild.latest_score()
        self.assertEqual(score, 4)

    def test_record_latest_post_assessment(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)

        post_assessment = "Post assessment"
        self.openendedchild.record_latest_post_assessment(post_assessment)
        self.assertEqual(post_assessment,
                         self.openendedchild.latest_post_assessment(self.test_system))

    def test_get_score(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)

        score = self.openendedchild.get_score()
        self.assertEqual(score['score'], 0)
        self.assertEqual(score['total'], self.static_data['max_score'])

#.........這裏部分代碼省略.........
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:103,代碼來源:test_combined_open_ended.py

示例2: OpenEndedChildTest

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import record_latest_post_assessment [as 別名]
class OpenEndedChildTest(unittest.TestCase):
    """
    Test the open ended child class
    """

    location = Location(["i4x", "edX", "sa_test", "selfassessment", "SampleQuestion"])

    metadata = json.dumps({"attempts": "10"})
    prompt = etree.XML("<prompt>This is a question prompt</prompt>")
    rubric = """<rubric><rubric>
        <category>
        <description>Response Quality</description>
        <option>The response is not a satisfactory answer to the question.  It either fails to address the question or does so in a limited way, with no evidence of higher-order thinking.</option>
        <option>Second option</option>
        </category>
         </rubric></rubric>"""
    max_score = 1

    static_data = {
        "max_attempts": 20,
        "prompt": prompt,
        "rubric": rubric,
        "max_score": max_score,
        "display_name": "Name",
        "accept_file_upload": False,
        "close_date": None,
        "s3_interface": "",
        "open_ended_grading_interface": {},
        "skip_basic_checks": False,
        "control": {
            "required_peer_grading": 1,
            "peer_grader_count": 1,
            "min_to_calibrate": 3,
            "max_to_calibrate": 6,
            "peer_grade_finished_submissions_when_none_pending": False,
        },
    }
    definition = Mock()
    descriptor = Mock()

    def setUp(self):
        self.test_system = get_test_system()
        self.test_system.open_ended_grading_interface = None
        self.openendedchild = OpenEndedChild(
            self.test_system, self.location, self.definition, self.descriptor, self.static_data, self.metadata
        )

    def test_latest_answer_empty(self):
        answer = self.openendedchild.latest_answer()
        self.assertEqual(answer, "")

    def test_latest_score_empty(self):
        answer = self.openendedchild.latest_score()
        self.assertEqual(answer, None)

    def test_latest_post_assessment_empty(self):
        answer = self.openendedchild.latest_post_assessment(self.test_system)
        self.assertEqual(answer, "")

    def test_new_history_entry(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)
        answer = self.openendedchild.latest_answer()
        self.assertEqual(answer, new_answer)

        new_answer = "Newer Answer"
        self.openendedchild.new_history_entry(new_answer)
        answer = self.openendedchild.latest_answer()
        self.assertEqual(new_answer, answer)

    def test_record_latest_score(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)
        new_score = 3
        self.openendedchild.record_latest_score(new_score)
        score = self.openendedchild.latest_score()
        self.assertEqual(score, 3)

        new_score = 4
        self.openendedchild.new_history_entry(new_answer)
        self.openendedchild.record_latest_score(new_score)
        score = self.openendedchild.latest_score()
        self.assertEqual(score, 4)

    def test_record_latest_post_assessment(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)

        post_assessment = "Post assessment"
        self.openendedchild.record_latest_post_assessment(post_assessment)
        self.assertEqual(post_assessment, self.openendedchild.latest_post_assessment(self.test_system))

    def test_get_score(self):
        new_answer = "New Answer"
        self.openendedchild.new_history_entry(new_answer)

        score = self.openendedchild.get_score()
        self.assertEqual(score["score"], 0)
        self.assertEqual(score["total"], self.static_data["max_score"])

#.........這裏部分代碼省略.........
開發者ID:rjsheperd,項目名稱:edx-platform,代碼行數:103,代碼來源:test_combined_open_ended.py


注:本文中的xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild.record_latest_post_assessment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。