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


Python response_xml_factory.OptionResponseXMLFactory類代碼示例

本文整理匯總了Python中capa.tests.response_xml_factory.OptionResponseXMLFactory的典型用法代碼示例。如果您正苦於以下問題:Python OptionResponseXMLFactory類的具體用法?Python OptionResponseXMLFactory怎麽用?Python OptionResponseXMLFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: redefine_option_problem

 def redefine_option_problem(self, problem_url_name):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_2),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_2,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     self.module_store.update_item(location, problem_xml)
開發者ID:LukeLu1263,項目名稱:edx-platform,代碼行數:10,代碼來源:test_base.py

示例2: redefine_option_problem

 def redefine_option_problem(self, problem_url_name, correct_answer=OPTION_1, num_inputs=1, num_responses=2):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = self._option_problem_factory_args(correct_answer, num_inputs, num_responses)
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     item = self.module_store.get_item(location)
     with self.module_store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, location.course_key):
         item.data = problem_xml
         self.module_store.update_item(item, self.user.id)
         self.module_store.publish(location, self.user.id)
開發者ID:TeachAtTUM,項目名稱:edx-platform,代碼行數:11,代碼來源:test_base.py

示例3: define_option_problem

 def define_option_problem(self, problem_url_name):
     """Create the problem definition so the answer is Option 1"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_1),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_1,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(parent_location=self.problem_section.location,
                        category="problem",
                        display_name=str(problem_url_name),
                        data=problem_xml)
開發者ID:LukeLu1263,項目名稱:edx-platform,代碼行數:12,代碼來源:test_base.py

示例4: define_option_problem

 def define_option_problem(self, problem_url_name, parent=None, **kwargs):
     """Create the problem definition so the answer is Option 1"""
     if parent is None:
         parent = self.problem_section
     factory = OptionResponseXMLFactory()
     factory_args = self._option_problem_factory_args()
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(parent_location=parent.location,
                        parent=parent,
                        category="problem",
                        display_name=problem_url_name,
                        data=problem_xml,
                        **kwargs)
開發者ID:TeachAtTUM,項目名稱:edx-platform,代碼行數:13,代碼來源:test_base.py

示例5: redefine_option_problem

 def redefine_option_problem(self, problem_url_name):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_2),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_2,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     item = self.module_store.get_item(location)
     with self.module_store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, location.course_key):
         item.data = problem_xml
         self.module_store.update_item(item, self.user.id)
         self.module_store.publish(location, self.user.id)
開發者ID:10clouds,項目名稱:edx-platform,代碼行數:14,代碼來源:test_base.py

示例6: define_option_problem

 def define_option_problem(self, problem_url_name, parent=None, **kwargs):
     """Create the problem definition so the answer is Option 1"""
     if parent is None:
         parent = self.problem_section
     factory = OptionResponseXMLFactory()
     factory_args = {
         "question_text": "The correct answer is {0}".format(OPTION_1),
         "options": [OPTION_1, OPTION_2],
         "correct_option": OPTION_1,
         "num_responses": 2,
     }
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(
         parent_location=parent.location,
         parent=parent,
         category="problem",
         display_name=problem_url_name,
         data=problem_xml,
         **kwargs
     )
開發者ID:longmen21,項目名稱:edx-platform,代碼行數:20,代碼來源:test_base.py


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